aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Analysis/null-deref-ps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index c73a0384fc..4ce4f8b03e 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -4,3 +4,15 @@ void f1(int *p) {
if (p) *p = 1;
else *p = 0; // expected-warning{{ereference}}
}
+
+struct foo_struct {
+ int x;
+};
+
+int f2(struct foo_struct* p) {
+
+ if (p)
+ p->x = 1;
+
+ return p->x++;
+}