Fixed #8233 (FP uninitvar found in bash:lib/readline/display.c)
This commit is contained in:
parent
8b384f8ee5
commit
4a9984d73b
|
@ -1595,7 +1595,7 @@ static bool valueFlowForward(Token * const startToken,
|
|||
errorLogger,
|
||||
settings);
|
||||
|
||||
if (isVariableChanged(startToken1, startToken1->link(), varid, var->isGlobal(), settings)) {
|
||||
if (!condAlwaysFalse && isVariableChanged(startToken1, startToken1->link(), varid, var->isGlobal(), settings)) {
|
||||
removeValues(values, truevalues);
|
||||
|
||||
std::list<ValueFlow::Value>::iterator it;
|
||||
|
@ -1626,6 +1626,14 @@ static bool valueFlowForward(Token * const startToken,
|
|||
errorLogger,
|
||||
settings);
|
||||
|
||||
if (!condAlwaysTrue && isVariableChanged(startTokenElse, startTokenElse->link(), varid, var->isGlobal(), settings)) {
|
||||
removeValues(values, falsevalues);
|
||||
|
||||
std::list<ValueFlow::Value>::iterator it;
|
||||
for (it = values.begin(); it != values.end(); ++it)
|
||||
it->changeKnownToPossible();
|
||||
}
|
||||
|
||||
// goto '}'
|
||||
tok2 = startTokenElse->link();
|
||||
|
||||
|
|
|
@ -2730,6 +2730,19 @@ private:
|
|||
"}";
|
||||
values = tokenValues(code, "n ==");
|
||||
ASSERT_EQUALS(true, values.size() != 1U || !values.front().isUninitValue());
|
||||
|
||||
// #8233
|
||||
code = "void foo() {\n"
|
||||
" int x;\n"
|
||||
" int y = 1;\n"
|
||||
" if (y>1)\n"
|
||||
" x = 1;\n"
|
||||
" else\n"
|
||||
" x = 1;\n"
|
||||
" if (x>1) {}\n"
|
||||
"}";
|
||||
values = tokenValues(code, "x >");
|
||||
ASSERT_EQUALS(true, values.size() == 1U && values.front().isIntValue());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue