public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing
@ 2002-08-12 15:05 Robert Dewar
  2002-08-13  9:51 ` Johannes Stezenbach
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Dewar @ 2002-08-12 15:05 UTC (permalink / raw)
  To: gcc-bugs, js, sirl; +Cc: gcc

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing
@ 2002-08-13 10:00 Robert Dewar
  2002-08-13 11:28 ` Johannes Stezenbach
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Dewar @ 2002-08-13 10:00 UTC (permalink / raw)
  To: dewar, js; +Cc: gcc-bugs, gcc, sirl

<<But I think it would be a good idea to give out a warning that old
(or new) junk code will no longer work with gcc-3.x when compiled with -O2.
After all the old junk code will have to be changed (or at least
identified, so -fno-strict-aliasing can be used where necessary). And
that's much easier when you know what to look for.
>>

Well such a warning could certainly go in the documentation, but surely you
are not suggesting that every time someone does a compilation with -O2 that
a junk warning be issued?

(the compiler cannot of course detect cases where there is a problem, that's
the whole point of the aliasing rules)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-08-13 11:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20020809190500.22817.qmail@sources.redhat.com>
2002-08-12  8:53 ` optimization/7557: gcc-3.1.1 (debian/i386): wrong code with -O2 / bitfields / pointer aliasing Johannes Stezenbach
2002-08-12 15:05 Robert Dewar
2002-08-13  9:51 ` Johannes Stezenbach
2002-08-13 10:00 Robert Dewar
2002-08-13 11:28 ` Johannes Stezenbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).