diff options
author | chriseth <c@ethdev.com> | 2015-03-13 20:14:51 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-14 00:31:56 +0800 |
commit | a16677dcfbd7fd7d42fbd6166e234b1b7001ec59 (patch) | |
tree | 2a885476ca571246df3615f4fcd79e3c74353879 /CompilerUtils.cpp | |
parent | 039b133c180b15863ee3104637c97822d815d932 (diff) | |
download | dexon-solidity-a16677dcfbd7fd7d42fbd6166e234b1b7001ec59.tar.gz dexon-solidity-a16677dcfbd7fd7d42fbd6166e234b1b7001ec59.tar.zst dexon-solidity-a16677dcfbd7fd7d42fbd6166e234b1b7001ec59.zip |
Fix gas for builtin.
Fixes #1300
Diffstat (limited to 'CompilerUtils.cpp')
-rw-r--r-- | CompilerUtils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp index 7b078e03..e517e384 100644 --- a/CompilerUtils.cpp +++ b/CompilerUtils.cpp @@ -138,6 +138,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) { unsigned const stackPosition = m_context.baseToCurrentStackOffset(m_context.getBaseStackOffsetOfVariable(_variable)); unsigned const size = _variable.getType()->getSizeOnStack(); + solAssert(stackPosition >= size, "Variable size and position mismatch."); // move variable starting from its top end in the stack if (stackPosition - size + 1 > 16) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_sourceLocation(_variable.getLocation()) @@ -148,8 +149,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize) { - if (_stackDepth > 16) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Stack too deep.")); + solAssert(_stackDepth <= 16, "Stack too deep."); for (unsigned i = 0; i < _itemSize; ++i) m_context << eth::dupInstruction(_stackDepth); } |