Merge pull request #8824 from ethereum/solYulDirtyMemory

Fix accessing memory reference types in yul codegen and clean up on memory reads.
This commit is contained in:
chriseth
2020-05-06 16:17:19 +02:00
committed by GitHub
4 changed files with 32 additions and 17 deletions
@@ -117,10 +117,12 @@ struct CopyTranslate: public yul::ASTCopier
reference.isOffset == false && reference.isSlot == false,
"Should not be called for offset/slot"
);
auto const& var = m_context.localVariable(*varDecl);
solAssert(var.type().sizeOnStack() == 1, "");
return yul::Identifier{
_identifier.location,
yul::YulString{m_context.localVariable(*varDecl).name()}
yul::YulString{var.commaSeparatedList()}
};
}
@@ -2080,13 +2082,7 @@ IRVariable IRGeneratorForStatements::readFromLValue(IRLValue const& _lvalue)
")\n";
},
[&](IRLValue::Memory const& _memory) {
if (_memory.byteArrayElement)
define(result) <<
m_utils.cleanupFunction(_lvalue.type) <<
"(mload(" <<
_memory.address <<
"))\n";
else if (_lvalue.type.isValueType())
if (_lvalue.type.isValueType())
define(result) <<
m_utils.readFromMemory(_lvalue.type) <<
"(" <<