There is an error in the implementation of the logic of reaching the Unknonw tristate in CmpOpTable.
void cmp_op_table_unknownX2(int x, int y, int z) { if (x >= y) { // x >= y [1, 1] if (x + z < y) return; // x + z < y [0, 0] if (z != 0) return; // x < y [0, 0] clang_analyzer_eval(x > y); // expected-warning{{TRUE}} expected-warning{{FALSE}} } }
We miss the FALSE warning because the false branch is infeasible.
We have to exploit simplification to discover the bug. If we had x < y
as the second condition then the analyzer would return the parent state
on the false path and the new constraint would not be part of the State.
But adding z to the condition makes both paths feasible.
The root cause of the bug is that we reach the Unknown tristate
twice, but in both occasions we reach the same Op that is >= in the
test case. So, we reached >= twice, but we never reached !=, thus
querying the Unknonw2x column with getCmpOpStateForUnknownX2 is
wrong.
The solution is to ensure that we reached both different Ops once.