Merge pull request #10912 from ethereum/calldataLValueSol2Yul

[Sol->Yul] Check lvalue kind is stack in case of calldata.
This commit is contained in:
Đorđe Mijović
2021-02-08 14:19:24 +01:00
committed by GitHub
@@ -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<IRLValue::Stack>(_lvalue.kind), "");
}
else
// Only define the expression, if it will not be written to.
define(_expression, readFromLValue(_lvalue));