http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46759

           Summary: incorrect array bounds warning?
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@yahoo.com


Created attachment 22598
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22598
small reproducer

Linux theta.lbl.gov 2.6.35.6-48.fc14.x86_64 #1 SMP Fri Oct 22 15:36:08 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)

g++ -Wall -O1 ~/bounds_warning.cpp # no warning

g++ -Wall -O2 ~/bounds_warning.cpp
bounds_warning.cpp: In function 'int main()':
bounds_warning.cpp:21:14: warning: array subscript is above array bounds

I stared at this for a while but couldn't find a problem with my code.

Is there maybe a problem with the optimizer?

Unfortunately I've been unable to bootstrap the 4.5 branch or the trunk.
Could someone try out the attached reproducer against the current svn
of the branch/trunk?

Reply via email to