--verify: Fix false negative in itc

This commit is contained in:
Daniel Marjamäki 2019-10-27 16:47:56 +01:00
parent 2fa9a29ea7
commit c899d7becf
1 changed files with 19 additions and 12 deletions

View File

@ -1068,7 +1068,15 @@ static ExprEngine::ValuePtr executeAddressOf(const Token *tok, Data &data)
static ExprEngine::ValuePtr executeDeref(const Token *tok, Data &data) static ExprEngine::ValuePtr executeDeref(const Token *tok, Data &data)
{ {
ExprEngine::ValuePtr pval = executeExpression(tok->astOperand1(), data); ExprEngine::ValuePtr pval = executeExpression(tok->astOperand1(), data);
if (pval) { if (!pval) {
auto v = getValueRangeFromValueType(data.getNewSymbolName(), tok->valueType(), *data.settings);
if (tok->astOperand1()->varId()) {
pval = std::make_shared<ExprEngine::PointerValue>(data.getNewSymbolName(), v, false, false);
data.assignValue(tok->astOperand1(), tok->astOperand1()->varId(), v);
}
call(data.callbacks, tok, v, &data);
return v;
}
auto addressOf = std::dynamic_pointer_cast<ExprEngine::AddressOfValue>(pval); auto addressOf = std::dynamic_pointer_cast<ExprEngine::AddressOfValue>(pval);
if (addressOf) { if (addressOf) {
auto val = data.getValue(addressOf->varId, tok->valueType(), tok); auto val = data.getValue(addressOf->varId, tok->valueType(), tok);
@ -1081,7 +1089,6 @@ static ExprEngine::ValuePtr executeDeref(const Token *tok, Data &data)
call(data.callbacks, tok, val, &data); call(data.callbacks, tok, val, &data);
return val; return val;
} }
}
return ExprEngine::ValuePtr(); return ExprEngine::ValuePtr();
} }