From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2903 invoked by alias); 7 Dec 2012 14:03:09 -0000 Received: (qmail 2297 invoked by uid 48); 7 Dec 2012 14:02:07 -0000 From: "fweimer at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/55616] New: bogus warning about undefined overflow after overflow check Date: Fri, 07 Dec 2012 14:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00724.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: fweimer@redhat.com CC: nils@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.