codegen: cleanup booleans before storing them into memory

This commit is contained in:
Yoichi Hirai 2016-11-10 14:41:50 +01:00
parent 03ccc6df70
commit 0123e74a2e
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -950,6 +950,8 @@ unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBou
else
{
solAssert(numBytes <= 32, "Memory store of more than 32 bytes requested.");
if (_type.category() == Type::Category::Bool)
m_context << Instruction::ISZERO << Instruction::ISZERO;
if (numBytes != 32 && !leftAligned && !_padToWordBoundaries)
// shift the value accordingly before storing
m_context << (u256(1) << ((32 - numBytes) * 8)) << Instruction::MUL;