summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-24 08:39:33 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-24 08:39:33 +0000
commit5614c46fcf5cf60fcb621b2eb699f160bc8e7078 (patch)
tree8f5df614be25c12af6baba0a0ebd096b82d1e91c /clang/test
parent5ce945ca3a08635419cb07f5852c43c92f5f98e8 (diff)
downloadbcm5719-llvm-5614c46fcf5cf60fcb621b2eb699f160bc8e7078.tar.gz
bcm5719-llvm-5614c46fcf5cf60fcb621b2eb699f160bc8e7078.zip
Add basic support for pointer arithmetic in
SimpleSValBuilder. This clears up some false positives emitted by ArrayBoundCheckerV2 due to the lack of support for pointer arithmetic. llvm-svn: 122546
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/out-of-bounds.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/test/Analysis/out-of-bounds.c b/clang/test/Analysis/out-of-bounds.c
index 598e1653763..d8e4ad915a0 100644
--- a/clang/test/Analysis/out-of-bounds.c
+++ b/clang/test/Analysis/out-of-bounds.c
@@ -44,7 +44,6 @@ void test1_ptr_ok(int x) {
p[99] = 1; // no-warning
}
-// ** FIXME ** Doesn't work yet because we don't support pointer arithmetic.
// Tests doing an out-of-bounds access before the start of an array using:
// - indirect pointer to buffer, manipulated using simple pointer arithmetic
// - constant integer index
@@ -53,7 +52,7 @@ void test1_ptr_arith(int x) {
int buf[100];
int *p = buf;
p = p + 100;
- p[0] = 1; // no-warning
+ p[0] = 1; // expected-warning{{Out of bound memory access}}
}
void test1_ptr_arith_ok(int x) {
@@ -63,21 +62,18 @@ void test1_ptr_arith_ok(int x) {
p[0] = 1; // no-warning
}
-// ** FIXME ** Doesn't work yet because we don't support pointer arithmetic.
void test1_ptr_arith_bad(int x) {
int buf[100];
int *p = buf;
p = p + 99;
- p[1] = 1; // no-warning
+ p[1] = 1; // expected-warning{{Out of bound memory access}}
}
-// ** FIXME ** we falsely emit a warning here because of our lack of
-// handling of pointer arithmetic.
void test1_ptr_arith_ok2(int x) {
int buf[100];
int *p = buf;
p = p + 99;
- p[-1] = 1; // expected-warning{{Out of bound}}
+ p[-1] = 1; // no-warning
}
// Tests doing an out-of-bounds access before the start of an array using:
OpenPOWER on IntegriCloud