Fix incorrect logic for condition (#2675)

This commit is contained in:
Paul Fultz II 2020-06-09 01:16:53 -05:00 committed by GitHub
parent 6d796b434e
commit 0c659a1499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -299,7 +299,7 @@ struct ForwardTraversal {
if (!condTok->hasKnownIntValue()) {
if (!analyzer->lowerToPossible())
return Progress::Break;
} else if (condTok->values().front().intvalue == !inElse) {
} else if (condTok->values().front().intvalue == inElse) {
return Progress::Break;
}
analyzer->assume(condTok, !inElse, tok);

View File

@ -1819,7 +1819,7 @@ private:
" y = 42 / x;\n" // <- x is 2
"}";
ASSERT_EQUALS(false, testValueOfX(code, 5U, 0));
TODO_ASSERT_EQUALS(true, false, testValueOfX(code, 5U, 2));
ASSERT_EQUALS(true, testValueOfX(code, 5U, 2));
code = "void f() {\n" // #6118 - FN
" int x = 0;\n"