Skip site navigation (1)Skip section navigation (2)
Date:      24 Sep 1999 11:06:53 +0300
From:      Ville-Pertti Keinonen <will@iki.fi>
To:        freebsd-current@FreeBSD.ORG
Subject:   Re: gcc optimizer in -current system ...
Message-ID:  <86zoycvile.fsf@not.demophon.com>
In-Reply-To: Oliver Fromme's message of "23 Sep 1999 22:33:13 %2B0300"
References:  <199909231928.VAA01658@dorifer.heim3.tu-clausthal.de.newsgate.clinet.fi>

next in thread | previous in thread | raw e-mail | index | archive | help

Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de> writes:

> The gcc optimizer is traditionally buggy.  I wouldn't trust a
> system compiled with anything more than -O (especially on
> production servers).  The higher optimization levels don't
> provide much of a speed improvement anyway, sometimes they make
> the code even slower.  YMMV.

This is a somewhat religious issue.  There is no absolutely safe
optimization level, and recommendations needn't remain constant,
especially as the compiler changes.

There are known problems that break code when compiling with -O.  I
know at least one case that breaks with -O or -O2 but works with -O3
(this applies to both pre-egcs and egcs compilers).  When things will
break is very unpredictable.

In my experience, -O2 rarely causes additional breakage compared to -O
in correct code.  In egcs >= 1.1 and gcc >= 2.95, -O2 includes new
optimizations that can improve performance quite significantly.

Sometimes breakage can also be caused by incorrect code that is only
exposed by the optimization.

You really shouldn't generalize too much.  All you can correctly state
is that software package X seems to work well with gcc/egcs version Y
at optimization level Z.  You can also state that some gcc/egcs
version has known bugs at some optimization level (however, all
reasonably current versions have known bugs at *all* optimization
levels).



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




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