Subject: Re: gcc optimizer bug in netbsd-1-6 on alpha (gcc 2.95.3 20010315 (release) (NetBSD nb3))
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Ian Lance Taylor <ian@airs.com>
List: tech-toolchain
Date: 08/15/2003 08:20:18
der Mouse <mouse@Rodents.Montreal.QC.CA> writes:

> That's fine as far as C goes.  But as far as I am concerned, gcc has
> just over-standardized itself into irrelevance.  One of C's strong
> points has always been that when you do something outside the bounds of
> what the language promises, like the cast you quote, you get results
> that are unsurprising to someone who knows the underlying machine.  It
> appears gcc has broken that, and it means that it is now useless as a
> language for things, like operating system implementations, where that
> property is important.

gcc does this (assumes that two variables of different types can not
refer to the same object) not to blindly follow the standard, but
because it permits a number of optimizations which are not otherwise
permitted.

These optimizations are off by default, but are turned on by default
at -O2 and greater.  You can turn them off using -fno-strict-aliasing.

Ian