Fix ICE when pop dyn storage array of mapping

This commit is contained in:
Leonardo Alt
2019-09-16 16:33:17 +02:00
parent 2d601a4f23
commit eab9f65610
4 changed files with 84 additions and 5 deletions
+10 -5
View File
@@ -896,11 +896,16 @@ void ArrayUtils::popStorageArrayElement(ArrayType const& _type) const
// Stack: ArrayReference oldLength
m_context << u256(1) << Instruction::SWAP1 << Instruction::SUB;
// Stack ArrayReference newLength
m_context << Instruction::DUP2 << Instruction::DUP2;
// Stack ArrayReference newLength ArrayReference newLength;
accessIndex(_type, false);
// Stack: ArrayReference newLength storage_slot byte_offset
StorageItem(m_context, *_type.baseType()).setToZero(SourceLocation(), true);
if (_type.baseType()->category() != Type::Category::Mapping)
{
m_context << Instruction::DUP2 << Instruction::DUP2;
// Stack ArrayReference newLength ArrayReference newLength;
accessIndex(_type, false);
// Stack: ArrayReference newLength storage_slot byte_offset
StorageItem(m_context, *_type.baseType()).setToZero(SourceLocation(), true);
}
// Stack: ArrayReference newLength
m_context << Instruction::SWAP1 << Instruction::SSTORE;
}