[Bug tree-optimization/92039] [10 Regression] Spurious -Warray-bounds warnings building 32-bit glibc
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Wed Oct 23 11:43:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 23 Oct 2019, marxin at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92039
>
> Martin Liška <marxin at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Keywords|needs-reduction |
> CC| |marxin at gcc dot gnu.org
>
> --- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
> Just for the record a reduced test-case:
>
> int a[3];
>
> void fn1(long b) {
> int i;
> for (i = 3; i >= b; --i)
> a[i] = a[i - b];
> }
>
> where does not need -m32:
>
> $ gcc -Werror=array-bounds -O2 -c ice.i
> ice.i: In function ‘fn1’:
> ice.i:6:6: error: array subscript 3 is above array bounds of ‘int[3]’
> [-Werror=array-bounds]
> 6 | a[i] = a[i - b];
> | ~^~~
> ice.i:1:5: note: while referencing ‘a’
> 1 | int a[3];
> | ^
> cc1: some warnings being treated as errors
>
> $ gcc-9 -Werror=array-bounds -O2 -c ice.i
The testcase is probably misreduced since the very first iteration
will write to a[3] out of bounds so it only is valid if the loop
is not entered, thus if b < 3.
More information about the Gcc-bugs
mailing list