diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 17:17:40 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-12-01 00:42:21 +0800 |
commit | d77c8f730ce6a7c4caa86bb8e3bf1e5ca13b2117 (patch) | |
tree | b31ae7b078522fe14cb3c66c987d88f57851b68c /libsolidity/codegen/CompilerUtils.cpp | |
parent | 5d7a1fda39d29329df675985b0d3e50548348b72 (diff) | |
download | dexon-solidity-d77c8f730ce6a7c4caa86bb8e3bf1e5ca13b2117.tar.gz dexon-solidity-d77c8f730ce6a7c4caa86bb8e3bf1e5ca13b2117.tar.zst dexon-solidity-d77c8f730ce6a7c4caa86bb8e3bf1e5ca13b2117.zip |
codegen: clean not only booleans but all types before storing them into memory
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 6763e995..edf457a1 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -941,7 +941,7 @@ void CompilerUtils::cleanHigherOrderBits(IntegerType const& _typeOnStack) m_context << ((u256(1) << _typeOnStack.numBits()) - 1) << Instruction::AND; } -unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const +unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) { unsigned numBytes = _type.calldataEncodedSize(_padToWordBoundaries); bool leftAligned = _type.category() == Type::Category::FixedBytes; @@ -950,8 +950,7 @@ 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; + convertType(_type, _type, true); if (numBytes != 32 && !leftAligned && !_padToWordBoundaries) // shift the value accordingly before storing m_context << (u256(1) << ((32 - numBytes) * 8)) << Instruction::MUL; |