Add regression test for 7013: valueFlowAfterCondition: false positive below overspecified code (#3055)

This commit is contained in:
Paul Fultz II 2021-01-17 09:29:11 -06:00 committed by GitHub
parent dd866f2898
commit 65395aeaa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -2591,6 +2591,16 @@ private:
"}\n";
ASSERT_EQUALS(false, testValueOfXImpossible(code, 10U, 1));
ASSERT_EQUALS(false, testValueOfXKnown(code, 10U, 0));
code = "int f(int a, int b) {\n"
" if (!a && !b)\n"
" return;\n"
" if ((!a && b) || (a && !b))\n"
" return;\n"
" int x = a;\n" // <- a is _not_ 0
" return x;\n"
"}\n";
ASSERT_EQUALS(false, testValueOfX(code, 7U, 0));
}
void valueFlowAfterConditionExpr() {