optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing
Robert Dewar
dewar@gnat.com
Mon Aug 12 15:05:00 GMT 2002
> 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.
More information about the Gcc
mailing list