Merge pull request #10241 from ethereum/solc-ewasm-exception

[solc] Handle exceptions in AssemblyStack.translate() gracefully
This commit is contained in:
Leonardo 2020-11-09 19:41:05 +00:00 committed by GitHub
commit b9d2f9f10f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1883,8 +1883,29 @@ bool CommandLineInterface::assemble(
if (_language != yul::AssemblyStack::Language::Ewasm && _targetMachine == yul::AssemblyStack::Machine::Ewasm)
{
stack.translate(yul::AssemblyStack::Language::Ewasm);
stack.optimize();
try
{
stack.translate(yul::AssemblyStack::Language::Ewasm);
stack.optimize();
}
catch (Exception const& _exception)
{
serr() << "Exception in assembler: " << boost::diagnostic_information(_exception) << endl;
return false;
}
catch (std::exception const& _e)
{
serr() <<
"Unknown exception during compilation" <<
(_e.what() ? ": " + string(_e.what()) : ".") <<
endl;
return false;
}
catch (...)
{
serr() << "Unknown exception in assembler." << endl;
return false;
}
sout() << endl << "==========================" << endl;
sout() << endl << "Translated source:" << endl;