1 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s 2 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s 3 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s 4 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s 5 6 #include <stdint.h> 7 8 void 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 } 21