public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "drow at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure Date: Tue, 17 Apr 2007 12:21:00 -0000 [thread overview] Message-ID: <bug-31602-3264@http.gcc.gnu.org/bugzilla/> (raw) GCC HEAD now warns about this testcase for mips-linux, reduced from gdb/value.c. Compile with -O2 -Wall: extern int foo(); int show_values (void) { int i; static int num; if (num <= 0) num = 1; for (i = num; i < num + 10; i++) foo(); return i; } overflow.c:10: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true I think that the problem arises when we assume that the loop is executed at least once; the initial condition is num < num + 10. However the warning does not arise if num is an argument to the function instead of a static variable. Unfortunately the warning appears to be correct. I say unfortunately because there's no apparent way to avoid the warning - which sounds more like -Wextra to -Wall. Does this this example contradict the "easy to avoid" statement in the -Wstrict-overflow=1 documentation? -- Summary: Overflow warning causes GDB -Werror build failure Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: drow at gcc dot gnu dot org GCC target triplet: mips-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
next reply other threads:[~2007-04-17 12:21 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-04-17 12:21 drow at gcc dot gnu dot org [this message] 2007-04-17 12:26 ` [Bug tree-optimization/31602] " drow at false dot org 2007-04-18 14:14 ` ian at airs dot com 2007-04-20 15:17 ` ian at airs dot com 2007-04-20 19:04 ` drow at gcc dot gnu dot org 2007-04-24 20:45 ` ian at gcc dot gnu dot org 2007-04-24 21:54 ` ian at gcc dot gnu dot org 2007-04-24 22:27 ` ian at airs dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-31602-3264@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).