aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2017-07-27 17:21:07 +0800
committerGitHub <noreply@github.com>2017-07-27 17:21:07 +0800
commitb68591c468841d85c43088fe9ff824654b1f6459 (patch)
tree16da954ba35a3519dd6e1d9afd8ce42e4cc85a59 /libsolidity
parent772de8c4d9cc58d8ad0ee8fc8e6252bd7cf184dc (diff)
parentaf57879187b65bf1deebd96ba80d08bd10f2f902 (diff)
downloaddexon-solidity-b68591c468841d85c43088fe9ff824654b1f6459.tar.gz
dexon-solidity-b68591c468841d85c43088fe9ff824654b1f6459.tar.zst
dexon-solidity-b68591c468841d85c43088fe9ff824654b1f6459.zip
Merge pull request #2644 from ethereum/toodeep
Report location on stack too deep if possible
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/CompilerContext.cpp1
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp7
2 files changed, 7 insertions, 1 deletions
diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp
index 6875bda1..9aaf5844 100644
--- a/libsolidity/codegen/CompilerContext.cpp
+++ b/libsolidity/codegen/CompilerContext.cpp
@@ -310,6 +310,7 @@ void CompilerContext::appendInlineAssembly(
if (stackDiff < 1 || stackDiff > 16)
BOOST_THROW_EXCEPTION(
CompilerError() <<
+ errinfo_sourceLocation(_identifier.location) <<
errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.")
);
if (_context == julia::IdentifierContext::RValue)
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 82518e8c..8a28b454 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -174,7 +174,12 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const&
retSizeOnStack = returnTypes.front()->sizeOnStack();
}
solAssert(retSizeOnStack == utils().sizeOnStack(returnTypes), "");
- solAssert(retSizeOnStack <= 15, "Stack is too deep.");
+ if (retSizeOnStack > 15)
+ BOOST_THROW_EXCEPTION(
+ CompilerError() <<
+ errinfo_sourceLocation(_varDecl.location()) <<
+ errinfo_comment("Stack too deep.")
+ );
m_context << dupInstruction(retSizeOnStack + 1);
m_context.appendJump(eth::AssemblyItem::JumpType::OutOfFunction);
}