This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49820] Explicit check for integer negative after abs optimized away
- From: "agner at agner dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Jul 2011 19:31:53 +0000
- Subject: [Bug c/49820] Explicit check for integer negative after abs optimized away
- Auto-submitted: auto-generated
- References: <bug-49820-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #13 from Agner Fog <agner at agner dot org> 2011-07-26 19:31:48 UTC ---
My example does indeed give a warning when compiled with -Wstrict-overflow=2.
Unfortunately, -Wall implies only -Wstrict-overflow=1 so I got no warning in
the first place. I think the warning levels need to be adjusted so that we get
the warning with -Wall because the consequences are no less serious than
ignoring an overflow check with if(a+const<a), which gives a warning with
-Wstrict-overflow=1