This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64739] New: Spurious "array subscript is above array bounds" warning
- From: "siddhesh at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Jan 2015 07:37:41 +0000
- Subject: [Bug tree-optimization/64739] New: Spurious "array subscript is above array bounds" warning
- Auto-submitted: auto-generated
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.