From bf75ee9aed60db9821442866295193b11b321729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 29 Jul 2015 10:49:17 +0200 Subject: [PATCH] Fixed #6885 (valueflow ignores assignment of variable via function call) --- lib/valueflow.cpp | 4 +++- test/testvalueflow.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 5476f3764..503e821d4 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1381,8 +1381,10 @@ static bool valueFlowForward(Token * const startToken, } if (inconclusive) { std::list::iterator it; - for (it = values.begin(); it != values.end(); ++it) + for (it = values.begin(); it != values.end(); ++it) { it->inconclusive = true; + it->changeKnownToPossible(); + } } } diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 111f084ce..887d7148f 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1618,6 +1618,13 @@ private: ASSERT_EQUALS(9, value.intvalue); ASSERT(value.isPossible()); + code = "void f() {\n" + " int x = 0;\n" + " fred.dostuff(x);\n" + " if (x < 0) {}\n" + "}\n"; + ASSERT(isNotKnownValues(code, "<")); + code = "void f() {\n" " int x = 0;\n" " if (y) { dostuff(x); }\n"