1 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection\
2 // RUN: -analyzer-config eagerly-assume=false -verify %s
4 void clang_analyzer_eval(int);
6 void testAnd(int i
, int *p
) {
9 clang_analyzer_eval((knownP
&& knownP
) == 1); // expected-warning{{TRUE}}
10 clang_analyzer_eval((knownP
&& nullP
) == 0); // expected-warning{{TRUE}}
11 clang_analyzer_eval((knownP
&& p
) == 1); // expected-warning{{UNKNOWN}}
14 void testOr(int i
, int *p
) {
17 clang_analyzer_eval((nullP
|| knownP
) == 1); // expected-warning{{TRUE}}
18 clang_analyzer_eval((nullP
|| nullP
) == 0); // expected-warning{{TRUE}}
19 clang_analyzer_eval((nullP
|| p
) == 1); // expected-warning{{UNKNOWN}}
24 int testTypeIsInt(int i
, void *p
) {
30 // These crashed the analyzer at some point.
31 int between(char *x
) {
34 return x
>= start
&& x
< end
;
38 void useUndef(void) { 0 || undef(); }
40 void testPointer(void) { (void) (1 && testPointer
&& 0); }
42 char *global_ap
, *global_bp
, *global_cp
;
43 void ambiguous_backtrack_1(void) {
45 (global_bp
- global_ap
? global_cp
[global_bp
- global_ap
] : 0) || 1;
50 int global_a
, global_b
;
51 void ambiguous_backtrack_2(int x
) {
52 global_a
= x
>= 2 ? 1 : x
;
53 global_b
== x
&& 9 || 2;