This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing
- From: dewar at gnat dot com (Robert Dewar)
- To: gcc-bugs at gcc dot gnu dot org, js at convergence dot de, sirl at gcc dot gnu dot org
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 12 Aug 2002 18:05:48 -0400 (EDT)
- Subject: Re: optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing
> I wonder: Thousands of software packages use -O2 by default.
> How many of them will fail mysteriously when compiled with gcc-3.1,
> just because of the implied -fstrict-aliasing?
Who knows? But it is just a special case of the general phenomenon that junk
code which people get away with often falls foul of perfectly legitimate
optimizations, and as compilers improve, such code fails.
It is nice of GCC to provide facilities for keeping old junk code running (there
is certainly no requirement for a C compiler to do so), but it seems clear that
the default for the highest optimization level should be to take advantage
of the aliasing rules, which are after all there *precisely* to enable effective
optimization.