Added "nonlval::LValAsInteger" to represent abstract LVals casted to integers, allowing us to track lvals when they are casted back to pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50108 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index b78c93a..6d954fd 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -1,5 +1,7 @@
// RUN: clang -checker-simple -verify %s
+#include<stdint.h>
+
void f1(int *p) {
if (p) *p = 1;
else *p = 0; // expected-warning{{ereference}}
@@ -27,3 +29,13 @@
return x[i+1]; // expected-warning{{Dereference of null pointer.}}
}
+int f4(int *p) {
+
+ uintptr_t x = p;
+
+ if (x)
+ return 1;
+
+ int *q = (int*) x;
+ return *q; // expected-warning{{Dereference of null pointer.}}
+}
\ No newline at end of file