Added test case to test null dereference checking with lval::ArrayOffset.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50454 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 2e66e18..86691bd 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -29,6 +29,16 @@
return x[i+1]; // expected-warning{{Dereference of null pointer.}}
}
+int f3_b(char* x) {
+
+ int i = 2;
+
+ if (x)
+ return x[i - 1];
+
+ return x[i+1]++; // expected-warning{{Dereference of null pointer.}}
+}
+
int f4(int *p) {
uintptr_t x = p;