blob: cef624577a6dcbca74324f21d8720807b35ad7d0 [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
2// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s &&
3// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s &&
4// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
Ted Kremenekfe952cb2008-06-19 17:55:38 +00005
Ted Kremenekcf69f2c2008-06-21 17:20:55 +00006#include <stdint.h>
Ted Kremenekfe952cb2008-06-19 17:55:38 +00007
8int f1(int * p) {
9
10 // This branch should be infeasible
11 // because __imag__ p is 0.
12 if (!p && __imag__ (intptr_t) p)
13 *p = 1; // no-warning
14
15 // If p != 0 then this branch is feasible; otherwise it is not.
16 if (__real__ (intptr_t) p)
17 *p = 1; // no-warning
18
19 *p = 2; // expected-warning{{Dereference of null pointer}}
20}