From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: preprpcessor for overiding gcc optimation switch Date: 20 Jun 2000 12:31:41 GMT Organization: Aachen University of Technology (RWTH) Lines: 28 Message-ID: <8ino7d$i9b$1@nets3.rz.RWTH-Aachen.DE> References: <83zop3o170 DOT fsf AT mercury DOT bitbucket> <25c58271 DOT fc969396 AT usw-ex0104-033 DOT remarq DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 961504301 18731 137.226.32.75 (20 Jun 2000 12:31:41 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 20 Jun 2000 12:31:41 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com batchex wrote: > The reason I'm asking this cause in one of my project, one (only > one) of the source file, when compiled with optimation, then try > to debug a function contained in that file in gdb, it will give > errorneous results. That shouldn't usually happen. Not unless you compile with some of the explicitly debugging-unfriendly options of gcc active, like -fomit-frame-pointer. That one may make debugging hard, or even impossible. Or was that function an inline assembly one, by any chance? If so, it's probably just plain buggy if optimization prevents you to run the debugger over it. > I forgot if gdb crashed while debugging it or not, but I remember > peculiar flow of my program. 'Peculiar flow' of control may not mean anything bad, while you're debugging an optimized program. Instruction scheduling, esp. in newer compilers, may easily cause things to happen in somewhat unexpected order, jumping back and forth among several source lines, and similar 'peculiarities'. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.