null-deref-ps.c revision b9ab690786f0edfe32798bbf4338cab23e08bc6e
1// RUN: clang -checker-simple -verify %s
2
3void f1(int *p) {
4  if (p) *p = 1;
5  else *p = 0; // expected-warning{{ereference}}
6}
7
8struct foo_struct {
9  int x;
10};
11
12int f2(struct foo_struct* p) {
13
14  if (p)
15    p->x = 1;
16
17  return p->x++;
18}
19