Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.glorb.com!news2.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: GCC/G++ compiler: Error goes away when run through debugger Date: Tue, 29 Mar 2011 12:18:24 -0400 Organization: A noiseless patient Spider Lines: 23 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-03-061@comp.compilers> References: <11-03-054@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: gal.iecc.com 1301426053 56386 64.57.183.58 (29 Mar 2011 19:14:13 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Tue, 29 Mar 2011 19:14:13 +0000 (UTC) Keywords: GCC, debug Posted-Date: 29 Mar 2011 15:14:13 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:61 On Sat, 26 Mar 2011 12:35:22 -0700 (PDT), "rhoads@cs.rutgers.edu" wrote: >I'm using the gcc/g++ compiler under Cygwin (an UNIX emulator that >runs on windows). > : >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? As Mark mentioned already, your problem is most likely uninitialized variables. But that said ... GCC's -O3 optimization level is widely known to cause strange problems ... almost always because the program is violating assumptions made by the more advanced optimizations. The -O2 level typically is safe. If you think you need the -O3 optimizations, you should individually enable them to see if any breaks the program. Specify -O3 only if you find they all work. George