This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53890] New: bogus array bounds warning
- From: "nathan at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 07 Jul 2012 20:30:42 +0000
- Subject: [Bug c/53890] New: bogus array bounds warning
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53890
Bug #: 53890
Summary: bogus array bounds warning
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: nathan@acm.org
Created attachment 27761
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27761
test case
compile the attached with:
./cc1 ary.cc -O2 -Wall -quiet
(don't worry that it's a .cc file, I found the bug in c++ code, but it
manifests in both C and C++ compilers)
see following warning:
ary.cc: In function 'Foo':
ary.cc:12:6: warning: array subscript is above array bounds [-Warray-bounds]
tmp[jx] = 4;
^
This is incorrect, the compiler cannot deduce that jx is out of range at this
point -- indeed in correct calls of Foo it won't be.