Re: GCC/G++ compiler: Error goes away when run through debugger

"BartC" <bc@freeuk.com>
Mon, 28 Mar 2011 11:34:01 +0100

          From comp.compilers

Related articles
GCC/G++ compiler: Error goes away when run through debugger rhoads@cs.rutgers.edu (rhoads@cs.rutgers.edu) (2011-03-26)
Re: GCC/G++ compiler: Error goes away when run through debugger nospam@no.spam (Mark in Sutherland) (2011-03-27)
Re: GCC/G++ compiler: Error goes away when run through debugger bobduff@shell01.TheWorld.com (Robert A Duff) (2011-03-27)
Re: GCC/G++ compiler: Error goes away when run through debugger robin51@dodo.com.au (robin) (2011-03-28)
Re: GCC/G++ compiler: Error goes away when run through debugger Pidgeot18@verizon.invalid (Joshua Cranmer) (2011-03-27)
Re: GCC/G++ compiler: Error goes away when run through debugger torbenm@diku.dk (2011-03-28)
Re: GCC/G++ compiler: Error goes away when run through debugger bc@freeuk.com (BartC) (2011-03-28)
Re: GCC/G++ compiler: Error goes away when run through debugger gneuner2@comcast.net (George Neuner) (2011-03-29)
Re: GCC/G++ compiler: Error goes away when run through debugger gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-29)
Re: GCC/G++ compiler: Error goes away when run through debugger ike@localhost.claranet.nl (2011-03-29)
Re: GCC/G++ compiler: Error goes away when run through debugger gneuner2@comcast.net (George Neuner) (2011-03-31)
Re: GCC/G++ compiler: Error goes away when run through debugger shankarke@gmail.com (Shankar) (2011-04-01)
| List of all articles for this month |
From: "BartC" <bc@freeuk.com>
Newsgroups: comp.compilers
Date: Mon, 28 Mar 2011 11:34:01 +0100
Organization: A noiseless patient Spider
References: 11-03-054
Keywords: C++, debug
Posted-Date: 29 Mar 2011 11:53:21 EDT

<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



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.