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: unassig...@gcc.gnu.org
        ReportedBy: nat...@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.

Reply via email to