aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-20 22:22:31 +0800
committerchriseth <c@ethdev.com>2016-05-20 22:52:40 +0800
commit708129abd5f67838913dd42df590b3b64a825e3a (patch)
treee1062211ac6c28f1b6a3beb6ab26ef0b28e34759 /libsolidity/codegen/ExpressionCompiler.cpp
parenta09583a2a49344034e8be22be91a4410f2982781 (diff)
downloaddexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar.gz
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar.bz2
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar.lz
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar.xz
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.tar.zst
dexon-solidity-708129abd5f67838913dd42df590b3b64a825e3a.zip
Fixes for invalid cleanups for small types.
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index a01e306e..16677093 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -360,8 +360,11 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
m_context << commonType.literalValue(nullptr);
else
{
- bool cleanupNeeded = commonType.category() == Type::Category::Integer &&
- (Token::isCompareOp(c_op) || c_op == Token::Div || c_op == Token::Mod);
+ bool cleanupNeeded = false;
+ if (Token::isCompareOp(c_op))
+ cleanupNeeded = true;
+ if (commonType.category() == Type::Category::Integer && (c_op == Token::Div || c_op == Token::Mod))
+ cleanupNeeded = true;
// for commutative operators, push the literal as late as possible to allow improved optimization
auto isLiteral = [](Expression const& _e)