Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: GCC/G++ compiler: Error goes away when run through debugger |
| Date | 2011-03-28 11:34 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <11-03-060@comp.compilers> (permalink) |
| References | <11-03-054@comp.compilers> |
<rhoads@cs.rutgers.edu> wrote in message news:11-03-054@comp.compilers... > I have an C++ application program that is producing incorrect results > but the error goes away when I run it through the debugger. > > I'm using the gcc/g++ compiler under Cygwin (an UNIX emulator that > runs on windows). > > When I used the -ggdb compiler flag so I can run it under the gdb > debugger, the error goes away. It also runs fine if I do both of the > following; extract a few of the input instances which generate > incorrect results and put them in a separate input file. > Use this input file and recompile the program with no optimization > flags (I am otherwise using the -O3 optimization flag). > > The -O3 optimizations are supposed to always produce the same > results. Running through the debugger is not supposed to change the > results either. Has anybody else encountered this behavior? You have a bug in your application, which is probably not just incorrect logic, but something more serious. (Does it crash or just give the wrong output?) Possibly ask in a language forum such as comp.lang.c++, where you may be asked to show sample code. (Also you will get feedback quicker than on a moderated group.) You need to do everything you can to make the error persistent, rather than make it go away. And to try and narrow down the place where it occurs. Your compiler may also have options to turn on warnings for suspect constructions; try turning on everything... -- Bartc
Back to comp.compilers | Previous | Next | Find similar
Re: GCC/G++ compiler: Error goes away when run through debugger "BartC" <bc@freeuk.com> - 2011-03-28 11:34 +0100
csiph-web