diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index eba7d7c52..ce0abbf75 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1554,7 +1554,7 @@ static void valueFlowSubFunction(TokenList *tokenlist, ErrorLogger *errorLogger, if (Token::Match(tok2, "%varid% !!=", varid2)) { for (std::list::const_iterator val = argvalues.begin(); val != argvalues.end(); ++val) setTokenValue(const_cast(tok2), *val); - } else if (Token::Match(tok2, "{|?")) { + } else if (Token::Match(tok2, "%oror%|&&|{|?")) { if (settings->debugwarnings) bailout(tokenlist, errorLogger, tok2, "parameter " + arg->name() + ", at '" + tok2->str() + "'"); break; diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 6ffdc052c..50b6149ad 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1279,6 +1279,14 @@ private: ASSERT_EQUALS(true, testValueOfX(code, 2U, 0)); ASSERT_EQUALS(false, testValueOfX(code, 3U, 0)); + code = "void f1(int *x) {\n" + " if (x &&\n" + " *x) {}\n" + "}\n" + "void f2() { f1(0); }"; + ASSERT_EQUALS(true, testValueOfX(code, 2U, 0)); + ASSERT_EQUALS(false, testValueOfX(code, 3U, 0)); + // #5861 - fp with float code = "void f1(float x) {\n" " return 1.0 / x;\n"