diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 900b07403..f9935c6c7 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -1068,19 +1068,26 @@ static ExprEngine::ValuePtr executeAddressOf(const Token *tok, Data &data) static ExprEngine::ValuePtr executeDeref(const Token *tok, Data &data) { ExprEngine::ValuePtr pval = executeExpression(tok->astOperand1(), data); - if (pval) { - auto addressOf = std::dynamic_pointer_cast(pval); - if (addressOf) { - auto val = data.getValue(addressOf->varId, tok->valueType(), tok); - call(data.callbacks, tok, val, &data); - return val; - } - auto pointer = std::dynamic_pointer_cast(pval); - if (pointer) { - auto val = pointer->data; - call(data.callbacks, tok, val, &data); - return val; + if (!pval) { + auto v = getValueRangeFromValueType(data.getNewSymbolName(), tok->valueType(), *data.settings); + if (tok->astOperand1()->varId()) { + pval = std::make_shared(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(pval); + if (addressOf) { + auto val = data.getValue(addressOf->varId, tok->valueType(), tok); + call(data.callbacks, tok, val, &data); + return val; + } + auto pointer = std::dynamic_pointer_cast(pval); + if (pointer) { + auto val = pointer->data; + call(data.callbacks, tok, val, &data); + return val; } return ExprEngine::ValuePtr(); }