Skip to content

Commit 65395ae

Browse files
authored
Add regression test for 7013: valueFlowAfterCondition: false positive below overspecified code (#3055)
1 parent dd866f2 commit 65395ae

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/testvalueflow.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,16 @@ class TestValueFlow : public TestFixture {
25912591
"}\n";
25922592
ASSERT_EQUALS(false, testValueOfXImpossible(code, 10U, 1));
25932593
ASSERT_EQUALS(false, testValueOfXKnown(code, 10U, 0));
2594+
2595+
code = "int f(int a, int b) {\n"
2596+
" if (!a && !b)\n"
2597+
" return;\n"
2598+
" if ((!a && b) || (a && !b))\n"
2599+
" return;\n"
2600+
" int x = a;\n" // <- a is _not_ 0
2601+
" return x;\n"
2602+
"}\n";
2603+
ASSERT_EQUALS(false, testValueOfX(code, 7U, 0));
25942604
}
25952605

25962606
void valueFlowAfterConditionExpr() {

0 commit comments

Comments
 (0)