From c899d7becfd84e0a3896f760dbf20c6cbc98a5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 27 Oct 2019 16:47:56 +0100 Subject: [PATCH] --verify: Fix false negative in itc --- lib/exprengine.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) 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(); }