Fixed a ICE on calldata to struct member copy

This commit is contained in:
hrkrshnn
2022-01-31 17:26:11 +01:00
parent ef8911a629
commit 0fe5811459
8 changed files with 262 additions and 2 deletions
@@ -2985,8 +2985,11 @@ void IRGeneratorForStatements::writeToLValue(IRLValue const& _lvalue, IRVariable
{
solAssert(_lvalue.type.sizeOnStack() == 1);
auto const* valueReferenceType = dynamic_cast<ReferenceType const*>(&_value.type());
solAssert(valueReferenceType && valueReferenceType->dataStoredIn(DataLocation::Memory));
appendCode() << "mstore(" + _memory.address + ", " + _value.part("mpos").name() + ")\n";
solAssert(valueReferenceType);
if (valueReferenceType->dataStoredIn(DataLocation::Memory))
appendCode() << "mstore(" + _memory.address + ", " + _value.part("mpos").name() + ")\n";
else
appendCode() << "mstore(" + _memory.address + ", " + m_utils.conversionFunction(_value.type(), _lvalue.type) + "(" + _value.commaSeparatedList() + "))\n";
}
},
[&](IRLValue::Stack const& _stack) { assign(_stack.variable, _value); },