summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/null-deref-ps.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/null-deref-ps.c')
-rw-r--r--clang/test/Analysis/null-deref-ps.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c
index 964b3e45506..57e4718fe69 100644
--- a/clang/test/Analysis/null-deref-ps.c
+++ b/clang/test/Analysis/null-deref-ps.c
@@ -62,4 +62,19 @@ int f6(int *p) {
return !p ? bar(p) : *p; // expected-warning {{Null pointer passed as an argument to a 'nonnull' parameter}}
}
+int* qux();
+
+int f7(int x) {
+
+ int* p = 0;
+
+ if (0 == x)
+ p = qux();
+
+ if (0 == x)
+ *p = 1; // no-warning
+
+ return x;
+}
+
OpenPOWER on IntegriCloud