aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorliana <liana@ethdev.com>2015-01-16 19:55:49 +0800
committerliana <liana@ethdev.com>2015-01-16 19:55:49 +0800
commit1142b99a643a676b9adb7ada0b19aa1c5d8f8401 (patch)
tree37a8eafd5cd9021fc79c64c6af8c050309adcc4a /ExpressionCompiler.cpp
parent00b0b0933de8f745451652e8838f0c09a741228e (diff)
downloaddexon-solidity-1142b99a643a676b9adb7ada0b19aa1c5d8f8401.tar.gz
dexon-solidity-1142b99a643a676b9adb7ada0b19aa1c5d8f8401.tar.zst
dexon-solidity-1142b99a643a676b9adb7ada0b19aa1c5d8f8401.zip
Corrected "delete" for local variables i.e. set them to 0
Added test case
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index c8b7f350..4eed68ea 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -810,9 +810,10 @@ void ExpressionCompiler::LValue::setToZero(Expression const& _expression) const
if (stackDiff > 16)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_sourceLocation(_expression.getLocation())
<< errinfo_comment("Stack too deep."));
- else if (stackDiff > 0)
- for (unsigned i = 0; i < m_size; ++i)
- *m_context << u256(0) << eth::swapInstruction(m_size - i) << eth::Instruction::POP;
+ solAssert(stackDiff <= m_size, "");
+ for (unsigned i = 0; i < m_size; ++i)
+ *m_context << u256(0) << eth::swapInstruction(stackDiff + (m_size - i) ) << eth::Instruction::POP;
+
break;
}
case LValue::STORAGE: