[Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure
drow at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 17 12:21:00 GMT 2007
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
More information about the Gcc-bugs
mailing list