Fixed #9731 (ValueFlow: does not handle many assignments well)

This commit is contained in:
Daniel Marjamäki 2020-06-08 21:17:12 +02:00
parent 7e361536de
commit 6d796b434e
2 changed files with 4 additions and 1 deletions

View File

@ -114,6 +114,9 @@ struct ForwardTraversal {
return Progress::Break;
if (action.isInvalid())
return Progress::Break;
if (action.isWrite() && !action.isRead())
// Analysis of this write will continue separately
return Progress::Break;
return Progress::Continue;
}

View File

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