[Bug c/31083] for (int i = 1; i != 0; i++); hangs for 32-bit ints with -O2 or above. Should wrap quickly.

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Mar 8 14:38:00 GMT 2007



------- Comment #2 from manu at gcc dot gnu dot org  2007-03-08 14:38 -------
I think you are relying on the fact that signed overflow wraps, when in
standard C it is actually undefined (it may wrap, it may not). To make integers
wrap on overflow you use unsigned or -fwrapv.

Thus, I think this is a duplicate of PR 30475.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31083



More information about the Gcc-bugs mailing list