1 // RUN: %clang_analyze_cc1 -verify %s \
2 // RUN: -Wno-unreachable-code -ffreestanding \
3 // RUN: -analyzer-checker=core \
4 // RUN: -analyzer-checker=debug.ExprInspection
8 int clang_analyzer_eval(int);
11 // This branch should be infeasible
12 // because __imag__ p is 0.
13 if (!p
&& __imag__ (intptr_t) p
)
16 // If p != 0 then this branch is feasible; otherwise it is not.
17 if (__real__ (intptr_t) p
)
20 *p
= 2; // expected-warning{{Dereference of null pointer}}
23 void complexFloat(__complex__
float f
) {
24 clang_analyzer_eval(__real__(f
) == 1); // expected-warning{{UNKNOWN}}
25 clang_analyzer_eval(__imag__(f
) == 1); // expected-warning{{UNKNOWN}}
30 clang_analyzer_eval(__real__(f
) == 1); // expected-warning{{UNKNOWN}}
31 clang_analyzer_eval(__imag__(f
) == 1); // expected-warning{{UNKNOWN}}
34 void complexInt(__complex__
int f
) {
35 clang_analyzer_eval(__real__(f
) == 1); // expected-warning{{UNKNOWN}}
36 clang_analyzer_eval(__imag__(f
) == 1); // expected-warning{{UNKNOWN}}
41 clang_analyzer_eval(__real__(f
) == 1); // expected-warning{{UNKNOWN}}
42 clang_analyzer_eval(__imag__(f
) == 1); // expected-warning{{UNKNOWN}}