diff options
author | alibabe <livescozy@gmail.com> | 2018-05-21 10:21:44 +0800 |
---|---|---|
committer | alibabe <livescozy@gmail.com> | 2018-05-29 12:58:03 +0800 |
commit | 53eafff4bb3b827d6e2b1d72e290ca9a2969e757 (patch) | |
tree | 344bc8e6c4dcf7e6c3e17c132eab1655fb5303c7 | |
parent | 8f04c59046595216e9fffd93435055aa864fbd1f (diff) | |
download | dexon-solidity-53eafff4bb3b827d6e2b1d72e290ca9a2969e757.tar.gz dexon-solidity-53eafff4bb3b827d6e2b1d72e290ca9a2969e757.tar.zst dexon-solidity-53eafff4bb3b827d6e2b1d72e290ca9a2969e757.zip |
Fixes #3718 by creating a local variable for the result of
`GasEstimator::breakToStatementLevel` and then assign it back to
gasCoast.
-rw-r--r-- | solc/CommandLineInterface.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 89ac8806..5fe75a14 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -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)) |