blob: 3900bcbfae688704aaf77ea4f87ec6b2089476e4 [file] [log] [blame]
Argyrios Kyrtzidisc4d2c902011-02-28 19:49:42 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
Ted Kremenekb8e26e62008-06-19 17:55:38 +00002
Ted Kremenek39a18842008-06-21 17:20:55 +00003#include <stdint.h>
Ted Kremenekb8e26e62008-06-19 17:55:38 +00004
Mike Stumpfd28a612009-07-21 18:44:24 +00005void f1(int * p) {
Ted Kremenekb8e26e62008-06-19 17:55:38 +00006
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}