Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2002 14:10:06 -0700
From:      David Schultz <dschultz@uclink.Berkeley.EDU>
To:        Charles Swiger <cswiger@mac.com>
Cc:        stable@FreeBSD.ORG
Subject:   Re: GCC options, was: Re: 4.7-RELEASE crash [file system]
Message-ID:  <20021021211006.GA10857@HAL9000.homeunix.com>
In-Reply-To: <006501c27929$67cf3cd0$0301a8c0@prime>
References:  <20021019130404.A25131-100000@edge.foundation.invalid> <001901c27798$d033df70$0301a8c0@prime> <3DB2399F.3060900@zbzoom.net> <003a01c27849$6367d4d0$0301a8c0@prime> <20021021161902.GA396@HAL9000.homeunix.com> <006501c27929$67cf3cd0$0301a8c0@prime>

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Charles Swiger <cswiger@mac.com>:
> > GCC specifically does *not* generate code that is any more or less
> > reliable when you use -g.  The GCC folks are fairly picky about
> > that rule.
> 
> The GCC team wants the compiler to produce reliable code under all
> circumstances, most likely.  What the compiler actually does may not
> correspond perfectly to that intention.

Their official policy is that gcc is supposed to produce identical
code with and without -g.  For example, there's a loop unrolling
optimization that can't be done with -g, and therefore it is not
done at all.  It's certainly possible that they screwed up
somewhere, but I doubt it.

> > As for optimization, I've never been bitten by any bugs in either -O0
> or -O,
> > but in theory -O0 would save you from any bugs in the optimizer.
> 
> -O0 means to disable the optimizer, agreed.  However, the optimizer isn't a
> single thing; it's an entire range of individual optimization techniques.
> 
> Different -O levels (-O0, -O, -O2, etc...) enable different combinations.
> Using -g may change some of the optimizations, such as disabling
> "-fomit-frame-pointer", if they are incompatible with symbolic debugging.

I don't think -O enables -fomit-frame-pointer period if the target
architecture can't support debugging without a frame pointer.  As
I said above, I think they got the -g thing right.  ;-)  But I take
your point that -O0 is sufficiently different from -O that the
former could lead to bad interactions that don't crop up with -O.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021021211006.GA10857>