diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 247983215..eaa609f4f 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1151,6 +1151,11 @@ static void execute(const Token *expr, *result = !(*result); } + else if (expr->str() == "," && expr->astOperand1() && expr->astOperand2()) { + execute(expr->astOperand1(), programMemory, result, error); + execute(expr->astOperand2(), programMemory, result, error); + } + else *error = true; } diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 1c043931e..b8df212c9 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1089,6 +1089,13 @@ private: "}"; ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + code = "void f() {\n" + " int x,y;\n" + " for (x = 0, y = 0; x < 10, y < 10; x++, y++)\n" // usage of , + " x;\n" + "}"; + ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); + code = "void foo(double recoveredX) {\n" " for (double x = 1e-18; x < 1e40; x *= 1.9) {\n" " double relativeError = (x - recoveredX) / x;\n"