http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124
Bug ID: 59124
Summary: [4.8 Regression] Wrong warnings "array subscript is
above array bounds"
Product: gcc
Version: 4.8.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: d.g.gorbachev at gmail dot com
$ gcc -S -Wall -O3 1.c
1.c: In function 'foo':
1.c:12:23: warning: array subscript is above array bounds [-Warray-bounds]
bar[j - 1] = baz[j - 1];
^
1.c:12:23: warning: array subscript is above array bounds [-Warray-bounds]
=============== 8< ===============
unsigned baz[6];
void foo(unsigned *bar, unsigned n)
{
unsigned i, j;
if (n > 6)
n = 6;
for (i = 1; i < n; i++)
for (j = i - 1; j > 0; j--)
bar[j - 1] = baz[j - 1];
}
=============== >8 ===============
GCC 4.8.0 20120902 /rev. 190863/ - works,
GCC 4.8.0 20121111 /rev. 193417/ - fails.