aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Analysis/null-deref-ps.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index e78aea0f8c..7f1db8749c 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -130,6 +130,35 @@ int* f7b(int *x) {
return x;
}
+int* f7c(int *x) {
+
+ int* p = 0;
+
+ if (((void*)0) == x)
+ p = qux();
+
+ if (((void*)0) != x)
+ return x;
+
+ // THIS IS WRONG. THIS NEEDS TO BE FIXED.
+ *p = 1; // expected-warning{{null}}
+ return x;
+}
+
+int* f7c2(int *x) {
+
+ int* p = 0;
+
+ if (((void*)0) == x)
+ p = qux();
+
+ if (((void*)0) == x)
+ return x;
+
+ *p = 1; // expected-warning{{null}}
+ return x;
+}
+
int f8(int *p, int *q) {
if (!p)