[Bug tree-optimization/64739] New: Spurious "array subscript is above array bounds" warning
siddhesh at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 23 07:39:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64739
Bug ID: 64739
Summary: Spurious "array subscript is above array bounds"
warning
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: siddhesh at redhat dot com
Reduced Reproducer:
$ cat foo.c
void
foo (char **inptrp, char *inend, int *wch, int *cnt)
{
int inlen = *cnt & 7;
if (inlen != 0)
{
char *inptr = *inptrp;
char bytebuf[4];
while (inptr < inend)
bytebuf[inlen++] = *inptr++;
*cnt = &bytebuf[inlen] - inptr;
*wch = *inptr;
}
}
$ gcc -O3 -Wall -o foo.s -S foo.c
foo.c: In function ‘foo’:
foo.c:11:16: warning: array subscript is above array bounds [-Warray-bounds]
bytebuf[inlen++] = *inptr++;
^
The warning disappears when one adds -fno-tree-vrp to the compile command.
The actual error appears when building the iconv bits in glibc.
More information about the Gcc-bugs
mailing list