https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039
Bug ID: 92039
Summary: [10 Regression] Spurious -Warray-bounds warnings
building 32-bit glibc
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jsm28 at gcc dot gnu.org
CC: rguenth at gcc dot gnu.org
Target Milestone: ---
Created attachment 47010
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47010&action=edit
Preprocessed source
The commit
r276645 | rguenth | 2019-10-07 07:53:45 +0000 (Mon, 07 Oct 2019) | 20 lines
2019-10-07 Richard Biener <[email protected]>
PR tree-optimization/91975
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Consistently
handle invariants.
introduced spurious -Warray-bounds warnings that break the glibc build for
certain 32-bit configurations (i686 and 32-bit powerpc and s390). I've attached
a testcase; compile with -m32 -O2 -Wall with an x86_64 compiler and you get:
In file included from ../sysdeps/ieee754/float128/strtof128_l.c:48,
from ../sysdeps/ieee754/float128/wcstof128_l.c:27:
../stdlib/strtod_l.c: In function '____wcstof128_l_internal':
../stdlib/strtod_l.c:1676:22: warning: array subscript -1 is below array bounds
of 'mp_limb_t[4]' {aka 'long unsigned int[4]'} [-Warray-bounds]
In file included from ../sysdeps/ieee754/float128/strtof128_l.c:48,
from ../sysdeps/ieee754/float128/wcstof128_l.c:27:
../stdlib/strtod_l.c:523:13: note: while referencing 'retval'
(Note the glibc build has been broken for other reasons lately; this issue was
bisected to that commit using the attached .i file rather than based on when
the glibc build worked or didn't work.)
The relevant code is:
# 1675 "../stdlib/strtod_l.c"
for (i = (((113) + ((32) - 1)) / (32)) - 1; i >= empty; --i)
retval[i] = retval[i - empty];
from which it should be clear that, as i >= empty, this warning is bogus. (i is
int and empty is mp_size_t which is long int.)