1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=debug.ExprInspection \
4 // RUN: -analyzer-config eagerly-assume=false \
7 void clang_analyzer_warnIfReached(void);
8 void clang_analyzer_eval(_Bool
);
10 void test_simplification_to_concrete_int_infeasible(int b
, int c
) {
11 if (c
+ b
!= 0) // c + b == 0
13 if (b
!= 1) // b == 1 --> c + 1 == 0
15 if (c
!= 1) // c == 1 --> 1 + 1 == 0 contradiction
17 clang_analyzer_warnIfReached(); // no-warning
19 // Keep the symbols and the constraints! alive.
24 void test_simplification_to_concrete_int_feasible(int b
, int c
) {
30 // b == 1 --> c + 1 == 0
33 // c == -1 --> -1 + 1 == 0 OK
34 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
35 clang_analyzer_eval(c
== -1); // expected-warning{{TRUE}}
37 // Keep the symbols and the constraints! alive.