This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: gcc 3.3 / i386 / -O2 question
- From: Michael Matz <matz at suse dot de>
- To: Dave Korn <dk at artimi dot com>
- Cc: 'Gerald Pfeifer' <gerald at pfeifer dot com>,'Beschorner Daniel' <Daniel dot Beschorner at facton dot com>, gcc at gcc dot gnu dot org,gcc-help at gcc dot gnu dot org
- Date: Wed, 17 Nov 2004 14:15:58 +0100 (CET)
- Subject: RE: gcc 3.3 / i386 / -O2 question
- References: <NUTMEG0wzGDCvPeSHvn00000800@NUTMEG.CAM.ARTIMI.COM>
Hi,
On Wed, 17 Nov 2004, Dave Korn wrote:
> Excuse me for butting in, but I don't understand what makes anyone
> think this code _ought_ to produce the same results at different -O
> levels[*].
While it's true that with signed arithmetic we are allowed to simply
break, such behaviour can (and in this case indeed does) point out a real
problem in the optimizers, so its often a bit too hasty to ignore a
problem just because the source code is not totally conformant. With
unsigned int a similar thing happens, namely that the second call to
H(B,C) is deleted. The SuSE compiler has unit-at-a-time, hence determines
that H is in fact a const function. Somehow it misses that C is modified
between the two calls, ergo it thinks that both calls give the same
results, and deletes the latter.
Ciao,
Michael.