[Bug c/30475] assert(int+100 > int) optimized away

ian at airs dot com gcc-bugzilla@gcc.gnu.org
Mon Jan 22 20:16:00 GMT 2007



------- Comment #49 from ian at airs dot com  2007-01-22 20:16 -------
In the C language standard "undefined behaviour" meants that the compiler can
do anything at all.  It means that the program is specifically undefined.

When you say that the compiler should not eliminate the test because the value
does turn out to be negative, you appear to be assuming that signed overflow is
actually "implementation defined behaviour."  That would have the property that
you are after.

When you say that -fwrapv makes the code faster, I don't know which benchmarks
you are relying on.  Other people have demonstrated that -fwrapv slows down the
well-known SPEC benchmark.

I've written some comments in the appropriate place: the gcc mailing list:
http://gcc.gnu.org/ml/gcc/2007-01/msg00885.html


-- 


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



More information about the Gcc-bugs mailing list