[Bug c/41882] gcc bug when comparing x to -x (linux, 32-bit)
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Oct 30 22:24:00 GMT 2009
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-10-30 22:23 -------
signed overflow invokes undefined behavior. You can use -fwrapv to make it
wrapping. Or you can use unsigned types for the comparison, like
if ((unsigned)x != -(unsigned)x)
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41882
More information about the Gcc-bugs
mailing list