Fixed #5062 (ValueFlow: Handle comma operator in abstract interpretation)
This commit is contained in:
parent
65f10edcb6
commit
7ca742c454
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue