This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/58926] -Wstrict-overflow unwanted warning comparing variables initialized from one of static duration
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Nov 2015 18:36:01 +0000
- Subject: [Bug tree-optimization/58926] -Wstrict-overflow unwanted warning comparing variables initialized from one of static duration
- Auto-submitted: auto-generated
- References: <bug-58926-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58926
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-11-11
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Still present on trunk. A slightly different test case involving two functions
is below.
The modified test case shows another problem with the warning: it names the
function foobar but the expression the diagnostic prints is the return
statement in foo. When the body of foobar is large, there may not be a way for
the user to figure out what's causing it.
$ cat u.c && gcc -O2 -S -Wall -o/dev/null u.c
int foo (int i, int j) {
return i + 1 < j;
}
int foobar (int i) {
return foo (i, i);
}
u.c: In function âfoobarâ:
u.c:2:18: warning: assuming signed overflow does not occur when assuming that
(X + c) < X is always false [-Wstrict-overflow]
return i + 1 < j;
^