[solc] Handle exceptions in AssemblyStack.translate() gracefully

This commit is contained in:
Alex Beregszaszi 2020-11-09 18:11:44 +00:00
parent 9230ddf110
commit 3246d0f9a9

View File

@ -1882,9 +1882,30 @@ bool CommandLineInterface::assemble(
sout() << stack.print() << endl;
if (_language != yul::AssemblyStack::Language::Ewasm && _targetMachine == yul::AssemblyStack::Machine::Ewasm)
{
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;