Ted Kremenek | b8e26e6 | 2008-06-19 17:55:38 +0000 | [diff] [blame^] | 1 | // RUN: clang -checker-simple -verify %s |
2 | |||||
3 | #include <stdlib.h> | ||||
4 | |||||
5 | int f1(int * p) { | ||||
6 | |||||
7 | // This branch should be infeasible | ||||
8 | // because __imag__ p is 0. | ||||
9 | if (!p && __imag__ (intptr_t) p) | ||||
10 | *p = 1; // no-warning | ||||
11 | |||||
12 | // If p != 0 then this branch is feasible; otherwise it is not. | ||||
13 | if (__real__ (intptr_t) p) | ||||
14 | *p = 1; // no-warning | ||||
15 | |||||
16 | *p = 2; // expected-warning{{Dereference of null pointer}} | ||||
17 | } |