commit | 9704eacf27608cf3549014dd198b0f1148a4a3a0 | [log] [tgz] |
---|---|---|
author | Ted Kremenek <kremenek@apple.com> | Tue Apr 22 04:56:55 2008 +0000 |
committer | Ted Kremenek <kremenek@apple.com> | Tue Apr 22 04:56:55 2008 +0000 |
tree | b65fcceb9361582564421eb8402ebebf9ff540ee | |
parent | 540cbe2b60294fe7b926c26b4f1840f544fe3011 [diff] |
Added null dereference test involving arrays. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50084 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index 214ccdd..b78c93a 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c
@@ -16,3 +16,14 @@ return p->x++; // expected-warning{{Dereference of null pointer.}} } + +int f3(char* x) { + + int i = 2; + + if (x) + return x[i - 1]; + + return x[i+1]; // expected-warning{{Dereference of null pointer.}} +} +