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