Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.compilers > #65

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!news2.glorb.com!usenet.stanford.edu!news.iecc.com!nerds-end
From "BartC" <bc@freeuk.com>
Newsgroups comp.compilers
Subject Re: GCC/G++ compiler: Error goes away when run through debugger
Date Mon, 28 Mar 2011 11:34:01 +0100
Organization A noiseless patient Spider
Lines 35
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <11-03-060@comp.compilers> (permalink)
References <11-03-054@comp.compilers>
NNTP-Posting-Host news.iecc.com
X-Trace gal.iecc.com 1301414001 19091 64.57.183.58 (29 Mar 2011 15:53:21 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Tue, 29 Mar 2011 15:53:21 +0000 (UTC)
Keywords C++, debug
Posted-Date 29 Mar 2011 11:53:21 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref x330-a1.tempe.blueboxinc.net comp.compilers:65

Show key headers only | View raw


<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


Thread

Re: GCC/G++ compiler: Error goes away when run through debugger "BartC" <bc@freeuk.com> - 2011-03-28 11:34 +0100

csiph-web