summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/array-bounds.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-27 21:21:40 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-27 21:21:40 +0000
commit84e6e5cd1a68c28ff0b118f02738d476ba63d357 (patch)
tree7359574487757c5ea1476d3f56495f2c43d28d5c /clang/test/SemaCXX/array-bounds.cpp
parentbb5abc7b494cd7ff48990abb3ab530342c1b40d7 (diff)
downloadbcm5719-llvm-84e6e5cd1a68c28ff0b118f02738d476ba63d357.tar.gz
bcm5719-llvm-84e6e5cd1a68c28ff0b118f02738d476ba63d357.zip
Fix a couple bugs in the way we handle array indexes in array bounds checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>.
llvm-svn: 151569
Diffstat (limited to 'clang/test/SemaCXX/array-bounds.cpp')
-rw-r--r--clang/test/SemaCXX/array-bounds.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/array-bounds.cpp b/clang/test/SemaCXX/array-bounds.cpp
index c1b37011727..57a9e3de6a2 100644
--- a/clang/test/SemaCXX/array-bounds.cpp
+++ b/clang/test/SemaCXX/array-bounds.cpp
@@ -247,3 +247,9 @@ void test_pr11007() {
double a[5]; // expected-note {{array 'a' declared here}}
test_pr11007_aux("foo", a[1000]); // expected-warning {{array index 1000 is past the end of the array}}
}
+
+void test_rdar10916006(void)
+{
+ int a[128]; // expected-note {{array 'a' declared here}}
+ a[(unsigned char)'\xA1'] = 1; // expected-warning {{array index 161 is past the end of the array}}
+}
OpenPOWER on IntegriCloud