mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Throw StackTooDeep earlier (with sourcelocatiom) for inline assembly issues
This commit is contained in:
parent
2969bc0f3e
commit
9d5b4150d4
@ -855,12 +855,6 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
);
|
);
|
||||||
solAssert(variable->type()->sizeOnStack() == 1, "");
|
solAssert(variable->type()->sizeOnStack() == 1, "");
|
||||||
solAssert(suffix == "slot", "");
|
solAssert(suffix == "slot", "");
|
||||||
if (stackDiff > 16 || stackDiff < 1)
|
|
||||||
BOOST_THROW_EXCEPTION(
|
|
||||||
StackTooDeepError() <<
|
|
||||||
errinfo_sourceLocation(_inlineAssembly.location()) <<
|
|
||||||
errinfo_comment("Stack too deep(" + to_string(stackDiff) + "), try removing local variables.")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (variable->type()->dataStoredIn(DataLocation::CallData))
|
else if (variable->type()->dataStoredIn(DataLocation::CallData))
|
||||||
{
|
{
|
||||||
@ -877,6 +871,12 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
else
|
else
|
||||||
solAssert(suffix.empty(), "");
|
solAssert(suffix.empty(), "");
|
||||||
|
|
||||||
|
if (stackDiff > 16 || stackDiff < 1)
|
||||||
|
BOOST_THROW_EXCEPTION(
|
||||||
|
StackTooDeepError() <<
|
||||||
|
errinfo_sourceLocation(_inlineAssembly.location()) <<
|
||||||
|
errinfo_comment("Stack too deep(" + to_string(stackDiff) + "), try removing local variables.")
|
||||||
|
);
|
||||||
_assembly.appendInstruction(swapInstruction(stackDiff));
|
_assembly.appendInstruction(swapInstruction(stackDiff));
|
||||||
_assembly.appendInstruction(Instruction::POP);
|
_assembly.appendInstruction(Instruction::POP);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user