This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gcc 3.3 / i386 / -O2 question


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]