This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34454] [4.3 regression] Overflow check is optimized away when -O2 is enabled
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2007 20:37:37 -0000
- Subject: [Bug middle-end/34454] [4.3 regression] Overflow check is optimized away when -O2 is enabled
- References: <bug-34454-10490@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from ian at airs dot com 2007-12-13 20:37 -------
Note that this gives a warning with -Wstrict-overflow.
And note that you get the desired behaviour if you compile with
-fno-strict-overflow.
As Pinski says, the code is simply incorrect according to standard C, but you
can use the -Wstrict-overflow and -fno-strict-overflow options to help fix
existing code bases.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34454