Merge pull request #4166 from alibabe/fix-3718-ret

Fix the Heisenbug
This commit is contained in:
chriseth 2018-07-16 13:38:42 +02:00 committed by GitHub
commit 236284a264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -986,10 +986,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))