
This patch fixes the situation when our knowledge of disequalities can help us figuring out that some assumption is infeasible, but the solver still produces a state with inconsistent constraints. Additionally, this patch adds a couple of assertions to catch this type of problems easier. Differential Revision: https://reviews.llvm.org/D98341
31 lines
522 B
C++
31 lines
522 B
C++
// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -verify %s
|
|
|
|
// expected-no-diagnostics
|
|
|
|
struct toggle {
|
|
bool value;
|
|
};
|
|
|
|
toggle global_toggle;
|
|
toggle get_global_toggle() { return global_toggle; }
|
|
|
|
int oob_access();
|
|
|
|
bool compare(toggle one, bool other) {
|
|
if (one.value != other)
|
|
return true;
|
|
|
|
if (one.value)
|
|
oob_access();
|
|
return true;
|
|
}
|
|
|
|
bool coin();
|
|
|
|
void bar() {
|
|
bool left = coin();
|
|
bool right = coin();
|
|
for (;;)
|
|
compare(get_global_toggle(), left) && compare(get_global_toggle(), right);
|
|
}
|