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

             Bug #: 52954
           Summary: Missing bounds check warning
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: xinlian...@gmail.com


int foo() {
  int arr[100];
  // ...
 return arr[100];
 }

 /*  From clang:

 array.cpp:4:10: warning: array index 100 is past the end of the array
(which contains 100 elements) [-Warray-bounds]
 return arr[100];
        ^   ~~~
array.cpp:2:3: note: array 'arr' declared here
 int arr[100];
 ^
1 warning generated.

*/

Reply via email to