blob: 952de737f75b789df149306ca565de2b61d86ea7 [file] [log] [blame]
Zhongxing Xu06079d12010-02-27 02:44:37 +00001// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
2
3int 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}