blob: 50c1a54d1016c3f95380c94257616869ad8b64b8 [file] [log] [blame]
Zhongxing Xu1c625f22010-05-06 03:38:27 +00001// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
2
Zhongxing Xu06079d12010-02-27 02:44:37 +00003int f1() {
4 int y = 1;
5 y++;
6 return y;
7}
8
9void f2() {
10 int x = 1;
11 x = f1();
12 if (x == 1) {
13 int *p = 0;
14 *p = 3; // no-warning
15 }
16 if (x == 2) {
17 int *p = 0;
Ted Kremenek452b84d2010-03-23 01:11:38 +000018 *p = 3; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
Zhongxing Xu06079d12010-02-27 02:44:37 +000019 }
20}