summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/null-deref-ps.c
blob: 4ce4f8b03eb84cad3478c94185e0b3cb572c50e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: clang -checker-simple -verify %s

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++;
}
OpenPOWER on IntegriCloud