Fix FP for symbolic values when the expression is not const (#3370)
This commit is contained in:
parent
3a7ba3cd29
commit
6767b57d4c
|
@ -4018,6 +4018,8 @@ static void valueFlowSymbolic(TokenList* tokenlist, SymbolDatabase* symboldataba
|
|||
continue;
|
||||
if (tok->astOperand2()->hasKnownIntValue())
|
||||
continue;
|
||||
if (!isConstExpression(tok->astOperand2(), tokenlist->getSettings()->library, true, tokenlist->isCPP()))
|
||||
continue;
|
||||
|
||||
Token* start = nextAfterAstRightmostLeaf(tok);
|
||||
const Token* end = scope->bodyEnd;
|
||||
|
|
|
@ -5998,6 +5998,13 @@ private:
|
|||
" return x;\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS(true, testValueOfXKnown(code, 5U, 1));
|
||||
|
||||
code = "int f(int i) {\n"
|
||||
" int j = i++;\n"
|
||||
" int x = i++;\n"
|
||||
" return x;\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS(false, testValueOfXKnown(code, 4U, "i++", 0));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue