GCC-4 compiler bug
Daniel Tralamazza
tralamazza at gmail.com
Wed Nov 28 17:45:27 PST 2007
Simon 'corecode' Schubert wrote:
Yea, it seems that GCC 4 started to exploit the C99 standard which says
that signed integer overflows are undefined. This is a nasty thing and
comes unexpected for many programmers and existing source.
I don't think this is new Simon, for example that program works fine
with gcc 4.0.1 on MacOS.
We have two choices here: "fix" code so that it doesn't rely on signed
integer overflows or hack gcc so that it won't do this one particular
optimization.
Signed arithmetic is tricky. Heck last time I checked abs(-2147483648)
was still returning -2147483648 :P
Now I would be inclined to say that gcc should behave, but on the other
hand I can't really see applications to this *except for checking
integer overflows in the first place*.
Opinions?
Does this code works correctly with -fwrapv ?
cheers,
Daniel
More information about the Kernel
mailing list