gcc 3.3 / i386 / -O2 question
Michael Matz
matz@suse.de
Wed Nov 17 13:40:00 GMT 2004
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.
More information about the Gcc
mailing list