1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=debug.ExprInspection \
6 // In this test we check whether the solver's symbol simplification mechanism
7 // is capable of reaching a fixpoint.
9 void clang_analyzer_warnIfReached();
11 void test_contradiction(int a
, int b
, int c
, int d
, int x
) {
18 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
20 // Bring in the contradiction.
24 // After the simplification of `b == 0` we have:
29 // Doing another iteration we reach the fixpoint (with a contradiction):
34 clang_analyzer_warnIfReached(); // no-warning, i.e. UNREACHABLE
36 // Enabling expensive checks would trigger an assertion failure here without
37 // the fixpoint iteration.
41 // Keep the symbols and the constraints! alive.
42 (void)(a
* b
* c
* d
* x
);
46 void test_true_range_contradiction(int a
, unsigned b
) {
47 if (!(b
> a
)) // unsigned b > int a
49 if (a
!= -1) // int a == -1
50 return; // Starts a simplification of `unsigned b > int a`,
51 // that results in `unsigned b > UINT_MAX`,
52 // which is always false, so the State is infeasible.
53 clang_analyzer_warnIfReached(); // no-warning