Fixes #3718 by creating a local variable for the result of

`GasEstimator::breakToStatementLevel` and then assign it back to
gasCoast.
This commit is contained in:
alibabe 2018-05-21 02:21:44 +00:00
parent 8f04c59046
commit 53eafff4bb

View File

@ -990,10 +990,15 @@ void CommandLineInterface::handleAst(string const& _argStr)
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
// FIXME: shouldn't this be done for every contract?
if (m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()))
gasCosts = GasEstimator::breakToStatementLevel(
{
//NOTE: keep the local variable `ret` to prevent a Heisenbug that could happen on certain mac os platform.
//See: https://github.com/ethereum/solidity/issues/3718 for details.
auto ret = GasEstimator::breakToStatementLevel(
GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts),
asts
);
gasCosts = ret;
}
bool legacyFormat = !m_args.count(g_argAstCompactJson);
if (m_args.count(g_argOutputDir))