fix issue##5007

This commit is contained in:
mestorlx 2018-10-15 12:54:48 -03:00
parent 2384947521
commit 9f9d6fdcc4
3 changed files with 13 additions and 6 deletions

View File

@ -132,6 +132,7 @@ Bugfixes:
* Type Checker: Fix internal error when array index is not an unsigned. * Type Checker: Fix internal error when array index is not an unsigned.
* Type System: Allow arbitrary exponents for literals with a mantissa of zero. * Type System: Allow arbitrary exponents for literals with a mantissa of zero.
* Parser: Fix incorrect source location for nameless parameters. * Parser: Fix incorrect source location for nameless parameters.
* Command Line Interface: Fix internal error when compiling stdin with no content and --ast option.
### 0.4.25 (2018-09-12) ### 0.4.25 (2018-09-12)

View File

@ -994,16 +994,14 @@ void CommandLineInterface::handleAst(string const& _argStr)
for (auto const& sourceCode: m_sourceCodes) for (auto const& sourceCode: m_sourceCodes)
asts.push_back(&m_compiler->ast(sourceCode.first)); asts.push_back(&m_compiler->ast(sourceCode.first));
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts; map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
// FIXME: shouldn't this be done for every contract? for (auto const& contract : m_compiler->contractNames())
if (m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()))
{ {
//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( auto ret = GasEstimator::breakToStatementLevel(
GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts), GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(contract), asts),
asts asts
); );
gasCosts = ret; for (auto const& it: ret)
gasCosts[it.first] += it.second;
} }
bool legacyFormat = !m_args.count(g_argAstCompactJson); bool legacyFormat = !m_args.count(g_argAstCompactJson);

View File

@ -292,6 +292,14 @@ SOLTMPDIR=$(mktemp -d)
if [[ "$result" != 0 ]] ; then if [[ "$result" != 0 ]] ; then
exit 1 exit 1
fi fi
# This should not fail
set +e
output=$(echo '' | "$SOLC" --ast - 2>/dev/null)
set -e
if [[ $? != 0 ]] ; then
exit 1
fi
) )
printTask "Testing soljson via the fuzzer..." printTask "Testing soljson via the fuzzer..."