aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/outofbound.c
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-11-24 02:19:49 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-11-24 02:19:49 +0000
commit20f0178a232029bea7f34adecb6e5bdd6fada483 (patch)
tree74bf72f88aad9e8cddf037c41c1550df1a7cb58f /test/Analysis/outofbound.c
parent6613d08a19aa6ce9b6330487f3bfac841d4b8a4d (diff)
Add test case for out-of-bound memory access checking.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/outofbound.c')
-rw-r--r--test/Analysis/outofbound.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
new file mode 100644
index 0000000000..17608ff168
--- /dev/null
+++ b/test/Analysis/outofbound.c
@@ -0,0 +1,6 @@
+// RUN: clang -checker-simple -analyzer-store-region -verify %s
+
+char f1() {
+ char* s = "abcd";
+ return s[4]; // expected-warning{{Load or store into an out-of-bound memory position.}}
+}