This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30475] assert(int+100 > int) optimized away
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jan 2007 20:16:33 -0000
- Subject: [Bug c/30475] assert(int+100 > int) optimized away
- References: <bug-30475-3511@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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