blob: 0698d9cd8b691943818bc54c37fb4a63e3425635 [file] [log] [blame]
Ted Kremenekb8e26e62008-06-19 17:55:38 +00001// RUN: clang -checker-simple -verify %s
2
Ted Kremenek39a18842008-06-21 17:20:55 +00003#include <stdint.h>
Ted Kremenekb8e26e62008-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}