]> granicus.if.org Git - clang/commitdiff
Add test case for out-of-bound memory access checking.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 24 Nov 2008 02:19:49 +0000 (02:19 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 24 Nov 2008 02:19:49 +0000 (02:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59931 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/outofbound.c [new file with mode: 0644]

diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
new file mode 100644 (file)
index 0000000..17608ff
--- /dev/null
@@ -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.}}
+}