[Bug c/49183] gcc removes assert
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 27 02:36:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49183
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-05-27 01:43:29 UTC ---
assert(i+10>i) is always true if i is signed as signed integer overflow is
undefined. If i is MAX_INT then i+10 will overflow and the result is
undefined, so GCC assumes that the result will never be less than i. If you
want signed integer to be defined as wrapping use -fwrapv.
More information about the Gcc-bugs
mailing list