[Bug c/49820] Explicit check for integer negative after abs optimized away

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 27 11:23:00 GMT 2011


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

--- Comment #14 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-07-27 11:23:25 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

If you are doing clever things, adjust the warning level you're using.  They
have been chosen after considering several trade-offs, so changing them would
entail redoing the full analysis.  Patches welcome.



More information about the Gcc-bugs mailing list