aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-16 19:38:42 +0800
committerGitHub <noreply@github.com>2018-07-16 19:38:42 +0800
commit236284a264e9bc481b4d4af391c70a88338580f8 (patch)
tree82781e596edeec2fcec8d3382c33c84453c5fb2d
parent98656423be9c22af44b788f0d273195788218416 (diff)
parent53eafff4bb3b827d6e2b1d72e290ca9a2969e757 (diff)
downloaddexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar.gz
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar.bz2
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar.lz
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar.xz
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.tar.zst
dexon-solidity-236284a264e9bc481b4d4af391c70a88338580f8.zip
Merge pull request #4166 from alibabe/fix-3718-ret
Fix the Heisenbug
-rw-r--r--solc/CommandLineInterface.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 4811f767..6a768a00 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -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))