https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80907
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Known to work| |4.7.4
Last reconfirmed| |2017-10-17
Component|c++ |tree-optimization
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
Summary|False positive: "warning: |[6/7/8 Regression] False
|array subscript is above |positive: "warning: array
|array bounds" |subscript is above array
| |bounds"
Known to fail| |4.8.3, 4.9.3, 5.3.0, 6.2.0,
| |7.1.0, 8.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. I see the same warning issued twice. The first revision to trigger
the warning is r192538 (gcc 4.8.0), thus marking this a regression.
$ cat a.c && gcc -O3 -S -Wall -Warray-bounds a.c
int x[3];
int n=2;
void foo()
{
for(int i=0;i<n;i++) for(int j=0;j<=i;j++) x[i+j]++;
}
a.c: In function ‘foo’:
a.c:6:49: warning: array subscript is above array bounds [-Warray-bounds]
for(int i=0;i<n;i++) for(int j=0;j<=i;j++) x[i+j]++;
~^~~~~
a.c:6:49: warning: array subscript is above array bounds [-Warray-bounds]