From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20475 invoked by alias); 5 Nov 2012 20:21:34 -0000 Received: (qmail 19810 invoked by uid 48); 5 Nov 2012 20:21:15 -0000 From: "mattiase at acm dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/55217] New: False -Wstrict-overflow warning Date: Mon, 05 Nov 2012 20:21:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mattiase at acm dot org 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-11/txt/msg00412.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55217 Bug #: 55217 Summary: False -Wstrict-overflow warning Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: mattiase@acm.org This code yields a false -Wstrict-overflow warning in gcc 4.7.2: void h(int *s); void f(int n, int s) { int r = 1; for (int i = 1; i < n; i++) if (r) r++; if (r * s >= s + 3) // warning here for (int j = 0; j < r; j++) h(&s); } beta.c:8:12: warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Wstrict-overflow] The condition is not on the form X+c= s + 3) // warning here for (int j = 0; j < r; j++) h(&s); }