diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index a42c329aa..09b31d1e4 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5239,6 +5239,7 @@ static bool evaluate(const Token *expr, const std::vector getFunctionArgumentValues(const Token *argtok) { std::list argvalues(argtok->values()); + removeImpossible(argvalues); if (argvalues.empty() && Token::Match(argtok, "%comp%|%oror%|&&|!")) { argvalues.emplace_back(0); argvalues.emplace_back(1); diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 7876219bf..be3580b95 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -3287,6 +3287,13 @@ private: " bool compare = c == b;\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + // #9361 + check("void f(char c) {\n" + " if (c == '.') {}\n" + " else if (isdigit(c) != 0) {}\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void alwaysTrueContainer() {