mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Report memoryguard in stack too deep error.
This commit is contained in:
parent
9bcfcc61a7
commit
dfb7bf2853
@ -25,6 +25,8 @@
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
#include <libyul/backends/evm/OptimizedEVMCodeTransform.h>
|
||||
|
||||
#include <libyul/optimiser/FunctionCallFinder.h>
|
||||
|
||||
#include <libyul/Object.h>
|
||||
#include <libyul/Exceptions.h>
|
||||
|
||||
@ -74,7 +76,22 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize)
|
||||
OptimizedEVMCodeTransform::UseNamedLabels::ForFirstFunctionOfEachName
|
||||
);
|
||||
if (!stackErrors.empty())
|
||||
BOOST_THROW_EXCEPTION(stackErrors.front());
|
||||
{
|
||||
vector<FunctionCall*> memoryGuardCalls = FunctionCallFinder::run(
|
||||
*_object.code,
|
||||
"memoryguard"_yulstring
|
||||
);
|
||||
auto stackError = stackErrors.front();
|
||||
string msg = stackError.comment() ? *stackError.comment() : "";
|
||||
if (memoryGuardCalls.empty())
|
||||
msg += "\nNo memoryguard was present. "
|
||||
"Consider using memory-safe assembly only and annotating it via "
|
||||
"\"/// @solidity memory-safe-assembly\".";
|
||||
else
|
||||
msg += "\nmemoryguard was present.";
|
||||
stackError << util::errinfo_comment(msg);
|
||||
BOOST_THROW_EXCEPTION(stackError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user