complex.c revision 6c07bdba93b095b66e2c8c82dd5ed458fa8285ea
1// 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 5 6#include <stdint.h> 7 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} 21