mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Report source location on "stack too deep" errors.
This commit is contained in:
parent
12b002b3b8
commit
2536bdd6d0
@ -1,7 +1,8 @@
|
|||||||
### 0.4.9 (unreleased)
|
### 0.4.9 (unreleased)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Compiler Interface: Contracts and libraries can be referenced with a `file:` prefix to make them unique.
|
* Compiler interface: Contracts and libraries can be referenced with a ``file:`` prefix to make them unique.
|
||||||
|
* Compiler interface: Report source location for "stack too deep" errors.
|
||||||
* AST: Use deterministic node identifiers.
|
* AST: Use deterministic node identifiers.
|
||||||
* Type system: Introduce type identifier strings.
|
* Type system: Introduce type identifier strings.
|
||||||
* Metadata: Do not include platform in the version number.
|
* Metadata: Do not include platform in the version number.
|
||||||
|
@ -486,7 +486,12 @@ bool ContractCompiler::visit(FunctionDefinition const& _function)
|
|||||||
stackLayout.push_back(i);
|
stackLayout.push_back(i);
|
||||||
stackLayout += vector<int>(c_localVariablesSize, -1);
|
stackLayout += vector<int>(c_localVariablesSize, -1);
|
||||||
|
|
||||||
solAssert(stackLayout.size() <= 17, "Stack too deep, try removing local variables.");
|
if (stackLayout.size() > 17)
|
||||||
|
BOOST_THROW_EXCEPTION(
|
||||||
|
CompilerError() <<
|
||||||
|
errinfo_sourceLocation(_function.location()) <<
|
||||||
|
errinfo_comment("Stack too deep, try removing local variables.")
|
||||||
|
);
|
||||||
while (stackLayout.back() != int(stackLayout.size() - 1))
|
while (stackLayout.back() != int(stackLayout.size() - 1))
|
||||||
if (stackLayout.back() < 0)
|
if (stackLayout.back() < 0)
|
||||||
{
|
{
|
||||||
@ -551,6 +556,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
if (stackDiff < 1 || stackDiff > 16)
|
if (stackDiff < 1 || stackDiff > 16)
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
CompilerError() <<
|
CompilerError() <<
|
||||||
|
errinfo_sourceLocation(_inlineAssembly.location()) <<
|
||||||
errinfo_comment("Stack too deep, try removing local variables.")
|
errinfo_comment("Stack too deep, try removing local variables.")
|
||||||
);
|
);
|
||||||
for (unsigned i = 0; i < variable->type()->sizeOnStack(); ++i)
|
for (unsigned i = 0; i < variable->type()->sizeOnStack(); ++i)
|
||||||
@ -591,6 +597,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
if (stackDiff > 16 || stackDiff < 1)
|
if (stackDiff > 16 || stackDiff < 1)
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
CompilerError() <<
|
CompilerError() <<
|
||||||
|
errinfo_sourceLocation(_inlineAssembly.location()) <<
|
||||||
errinfo_comment("Stack too deep, try removing local variables.")
|
errinfo_comment("Stack too deep, try removing local variables.")
|
||||||
);
|
);
|
||||||
for (unsigned i = 0; i < size; ++i) {
|
for (unsigned i = 0; i < size; ++i) {
|
||||||
|
@ -250,7 +250,12 @@ bool ExpressionCompiler::visit(Assignment const& _assignment)
|
|||||||
}
|
}
|
||||||
if (lvalueSize > 0)
|
if (lvalueSize > 0)
|
||||||
{
|
{
|
||||||
solAssert(itemSize + lvalueSize <= 16, "Stack too deep, try removing local variables.");
|
if (itemSize + lvalueSize > 16)
|
||||||
|
BOOST_THROW_EXCEPTION(
|
||||||
|
CompilerError() <<
|
||||||
|
errinfo_sourceLocation(_assignment.location()) <<
|
||||||
|
errinfo_comment("Stack too deep, try removing local variables.")
|
||||||
|
);
|
||||||
// value [lvalue_ref] updated_value
|
// value [lvalue_ref] updated_value
|
||||||
for (unsigned i = 0; i < itemSize; ++i)
|
for (unsigned i = 0; i < itemSize; ++i)
|
||||||
m_context << swapInstruction(itemSize + lvalueSize) << Instruction::POP;
|
m_context << swapInstruction(itemSize + lvalueSize) << Instruction::POP;
|
||||||
|
Loading…
Reference in New Issue
Block a user