From: Ted Kremenek Date: Tue, 29 Apr 2008 23:25:09 +0000 (+0000) Subject: Added test case to test null dereference checking with lval::ArrayOffset. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2013f5646cb4a09b71e2708fbe9f8df43f5d7d6;p=clang 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 2e66e18b66..86691bd9a3 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -29,6 +29,16 @@ int f3(char* x) { 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;