blob: 22a239aace69328d2231c3eb09434076bf1a36a1 [file] [log] [blame]
Daniel Dunbar9c321102009-01-20 23:17:32 +00001// RUN: clang -analyze -checker-simple -verify %s
Ted Kremenekfe952cb2008-06-19 17:55:38 +00002
Ted Kremenekcf69f2c2008-06-21 17:20:55 +00003#include <stdint.h>
Ted Kremenekfe952cb2008-06-19 17:55:38 +00004
5int 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}