Subject: Re: gcc optimizer bug in netbsd-1-6 on alpha (gcc 2.95.3 20010315 (release) (NetBSD nb3))
To: Ian Lance Taylor <firstname.lastname@example.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
Date: 08/15/2003 09:45:13
>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
Yes, we know; no need to be condescending. And there's a good case
that that *is* blindly following the standard, at least by certain
local lights. The issue isn't a strict legalese reading of the
standard; its an issue of a culture of (pre-C99) C coding in embedded,
or machine-dependent environments like OS kernels.
>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.
I that's the root of the problem: having -fstrict-aliasing on by
default for -O2. IT seems pretty ill-considered to me, in that this
*is* a language change (vis-a-vis previous versions of gcc). I'd have
argued to leave it off, unless explicitly compiling with -ansi.
(Personally I think its a very nice fit for -ansi -pedantic, tho'
thats not what those flags have historically meant for gcc).