https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63510
Bug ID: 63510 Summary: Wrong line number in Wstrict-overflow message Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ibuclaw at ubuntu dot com Tested on gcc (GCC) 5.0.0 20140901 (experimental) Building GDB fails with the following error - both of which show the wrong line. ../../gdb/i387-tdep.c: In function ‘i387_supply_fsave’: ../../gdb/i387-tdep.c:447:1: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow] i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave) ^ ../../gdb/i387-tdep.c: In function ‘i387_collect_fsave’: ../../gdb/i387-tdep.c:502:1: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow] i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave) ^ Reduced to the following code, which shows both the correct and wrong line. gcc -O2 -Wall -Wextra -c i387-tdep.c --- int st0_regnum; void i387_supply_fsave () { int i; for (i = st0_regnum; i < st0_regnum + 16;) { } } --- i387-tdep.c: In function ‘i387_supply_fsave’: i387-tdep.c:9:1: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow] } ^ i387-tdep.c:6:3: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow] for (i = st0_regnum; i < st0_regnum + 16;) ^