[Bug c/49820] Explicit check for integer negative after abs optimized away
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 24 09:41:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-24 09:40:57 UTC ---
(In reply to comment #8)
> Why is the behavior different for signed and unsigned?
> The expression (a + 5 < a) is reduced to always false when a is signed, but not
> when a is unsigned.
Because for unsigned, wrapping is the behavior for UINT_MAX +1. As there is no
overflow for unsigned integer, a+5 can be less than a.
More information about the Gcc-bugs
mailing list