complex.c revision 9945781a1f59269188403752be3028d3d248c46b
1// RUN: clang -analyze -checker-simple -verify %s && 2// RUN: clang -analyze -checker-cfref -analyzer-store-basic -verify %s && 3// RUN: clang -analyze -checker-cfref -analyzer-store-region -verify %s 4 5#include <stdint.h> 6 7int f1(int * p) { 8 9 // This branch should be infeasible 10 // because __imag__ p is 0. 11 if (!p && __imag__ (intptr_t) p) 12 *p = 1; // no-warning 13 14 // If p != 0 then this branch is feasible; otherwise it is not. 15 if (__real__ (intptr_t) p) 16 *p = 1; // no-warning 17 18 *p = 2; // expected-warning{{Dereference of null pointer}} 19} 20