diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-27 21:21:40 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-27 21:21:40 +0000 |
commit | 92b670e1ee0b11d7e558ec659795ddf452e583ed (patch) | |
tree | da36273fd8126a33be4ae60c2446abbc7d699f5b /test/SemaCXX/array-bounds.cpp | |
parent | d45d361f2ce5c37824052357e2218e8a5509eba5 (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151569 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/array-bounds.cpp')
-rw-r--r-- | test/SemaCXX/array-bounds.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/SemaCXX/array-bounds.cpp b/test/SemaCXX/array-bounds.cpp index c1b3701172..57a9e3de6a 100644 --- a/test/SemaCXX/array-bounds.cpp +++ b/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}} +} |