[Bug c++/52954] New: Missing bounds check warning
xinliangli at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 12 21:55:00 GMT 2012
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: unassigned@gcc.gnu.org
ReportedBy: xinliangli@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.
*/
More information about the Gcc-bugs
mailing list