This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53198] New: [4.6 Regression] gcc wrongly emits "array subscript is above array bounds" for simple arrays
- From: "vapier at gentoo dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 May 2012 18:35:03 +0000
- Subject: [Bug c/53198] New: [4.6 Regression] gcc wrongly emits "array subscript is above array bounds" for simple arrays
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53198
Bug #: 53198
Summary: [4.6 Regression] gcc wrongly emits "array subscript is
above array bounds" for simple arrays
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: vapier@gentoo.org
CC: toolchain@gentoo.org
Target: x86_64-linux-gnu
simple code that processes arrays based on NULL terminator rather than
ARRAY_SIZE
$ cat test.c
void *devices[] = { 0, };
int main()
{
int i;
for (i = 0; devices[i]; i++)
;
return 0;
}
$ gcc -Warray-bounds -O2 test.c
test.c: In function 'main':
test.c:5:21: warning: array subscript is above array bounds [-Warray-bounds]
looks like it started failing with 4.6.0 ... older versions are fine.