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



             Bug #: 55616

           Summary: bogus warning about undefined overflow after overflow

                    check

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: fwei...@redhat.com

                CC: n...@redhat.com





Created attachment 28893

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28893

overflow-check.c



Code which performs proper overflow checking results in a compiler warning (at

-O2, without -fwrapv):



overflow-check.c:9:6: warning: assuming signed overflow does not occur when

assuming that (X + c) < X is always false [-Wstrict-overflow]

   if (a > b)

      ^



I'm surprised that the call to something from f is not optimized away with

-fwrapv.  Shouldn't VRP catch this?  Addressing this missed optimization

opportunity might also fix the warning.



The g function in the test case intends to make the if statement in r actually

relevant.



This is not a regression, it happens with 4.7.2 as well.

Reply via email to