Zhongxing Xu | 52c28fe | 2010-04-20 05:48:57 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s |
2 | struct A { | ||||
3 | int x; | ||||
4 | A(int a) { x = a; } | ||||
5 | int getx() { return x; } | ||||
6 | }; | ||||
7 | |||||
8 | void f1() { | ||||
9 | A x(3); | ||||
10 | if (x.getx() == 3) { | ||||
11 | int *p = 0; | ||||
12 | *p = 3; // expected-warning{{Dereference of null pointer}} | ||||
13 | } else { | ||||
14 | int *p = 0; | ||||
15 | *p = 3; // no-warning | ||||
16 | } | ||||
17 | } | ||||
18 |