This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/58926] -Wstrict-overflow unwanted warning comparing variables initialized from one of static duration


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;
                  ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]