Boost logo

Boost-Build :

From: Jos Hickson (jos.hickson_at_[hidden])
Date: 2007-07-11 09:28:57


I've trawled the GCC mailing list and found the following from 01/2007:

<quote>
Andreas Bogk <andreas_at_[hidden]> writes:

> Then maybe it shouldn't be the default in autoconf. But wasn't -O3 the
> set of optimizations considered potentially unsafe?

No. -O3 is a set of optimizations which are useful for many program
but which will cause a substantial number of programs to run slower.
-O2 is a set of optimizations which we believe will make (almost) all
programs run faster. -O1 also makes (almost) all programs run faster.
The difference between -O1 and -O2 is that it takes longer to run the
compiler with -O2.

gcc never enables unsafe optimizations except by explicit request via
-f options (e.g., -ffast-math), where "unsafe" is defined as
"violating the language standard."
</quote>

This is from http://gcc.gnu.org/ml/gcc/2007-01/msg01095.html. So, I
am mistaken in my belief and apologies for that. However, here we
have had problems with the inlining turned on by O3 even in a very
simple program that I don't have to hand right now though this
particular problem at least may well be a GCC bug, we're not sure yet.

However, it is interesting to note that the author of the response
above says that -O3 "will cause a substantial number of programs to
run slower." How "official" this statement is, I don't know.

Regards,

Jos

On 11/07/07, Dean Michael Berris <mikhailberis_at_[hidden]> wrote:
> On 7/11/07, Jos Hickson <jos.hickson_at_[hidden]> wrote:
> > [snip]
> > >
> > > > One thing I was wonder was why -O3 is the default as that is usually
> > > > considered a bit risky?
> > >
> > > Is it? I'm not aware of that.
> > >
> >
> > To quote from the Gentoo Linux "Safe CFLAGS" page
> > (http://gentoo-wiki.com/Safe_Cflags) as an example:
> >
> > <quote>
> > Note that -O2 is regarded as safer than "-O3", and "-O3" can often be
> > a counter-productive attempt at optimization.
> > </quote>
> >
>
> Any particular reason why this would be the case? How is "safety"
> defined in this manner? Does conservative optimization mean safer?
>
> --
> Dean Michael C. Berris
> http://cplusplus-soup.blogspot.com/
> mikhailberis AT gmail DOT com
> +63 928 7291459
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk