From e53feaedc443f4443bcb881c86ab8479f18ea3da Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Mon, 8 Feb 2021 13:27:51 +0100 Subject: [PATCH] [Sol->Yul] Check lvalue kind is stack in case of calldata. --- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index e4b0cb8e3..52100dfb0 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -2918,7 +2918,11 @@ void IRGeneratorForStatements::setLValue(Expression const& _expression, IRLValue solAssert(!m_currentLValue, ""); if (_expression.annotation().willBeWrittenTo) + { m_currentLValue.emplace(std::move(_lvalue)); + if (_lvalue.type.dataStoredIn(DataLocation::CallData)) + solAssert(holds_alternative(_lvalue.kind), ""); + } else // Only define the expression, if it will not be written to. define(_expression, readFromLValue(_lvalue));