mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3943 from ethereum/smt_remove_branch_warning
[SMTChecker] Remove 'information is erase' message for if-else
This commit is contained in:
commit
676732776e
@ -77,7 +77,7 @@ bool SMTChecker::visit(FunctionDefinition const& _function)
|
|||||||
m_interface->reset();
|
m_interface->reset();
|
||||||
m_variables.clear();
|
m_variables.clear();
|
||||||
m_pathConditions.clear();
|
m_pathConditions.clear();
|
||||||
m_conditionalExecutionHappened = false;
|
m_loopExecutionHappened = false;
|
||||||
initializeLocalVariables(_function);
|
initializeLocalVariables(_function);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -132,6 +132,7 @@ bool SMTChecker::visit(WhileStatement const& _node)
|
|||||||
|
|
||||||
visitBranch(_node.body(), expr(_node.condition()));
|
visitBranch(_node.body(), expr(_node.condition()));
|
||||||
}
|
}
|
||||||
|
m_loopExecutionHappened = true;
|
||||||
resetVariables(touchedVariables);
|
resetVariables(touchedVariables);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -171,7 +172,7 @@ bool SMTChecker::visit(ForStatement const& _node)
|
|||||||
|
|
||||||
m_interface->pop();
|
m_interface->pop();
|
||||||
|
|
||||||
m_conditionalExecutionHappened = true;
|
m_loopExecutionHappened = true;
|
||||||
std::swap(sequenceCountersStart, m_variables);
|
std::swap(sequenceCountersStart, m_variables);
|
||||||
|
|
||||||
resetVariables(touchedVariables);
|
resetVariables(touchedVariables);
|
||||||
@ -548,7 +549,6 @@ SMTChecker::VariableSequenceCounters SMTChecker::visitBranch(Statement const& _s
|
|||||||
if (_condition)
|
if (_condition)
|
||||||
popPathCondition();
|
popPathCondition();
|
||||||
|
|
||||||
m_conditionalExecutionHappened = true;
|
|
||||||
std::swap(m_variables, beforeVars);
|
std::swap(m_variables, beforeVars);
|
||||||
|
|
||||||
return beforeVars;
|
return beforeVars;
|
||||||
@ -591,10 +591,10 @@ void SMTChecker::checkCondition(
|
|||||||
vector<string> values;
|
vector<string> values;
|
||||||
tie(result, values) = checkSatisfiableAndGenerateModel(expressionsToEvaluate);
|
tie(result, values) = checkSatisfiableAndGenerateModel(expressionsToEvaluate);
|
||||||
|
|
||||||
string conditionalComment;
|
string loopComment;
|
||||||
if (m_conditionalExecutionHappened)
|
if (m_loopExecutionHappened)
|
||||||
conditionalComment =
|
loopComment =
|
||||||
"\nNote that some information is erased after conditional execution of parts of the code.\n"
|
"\nNote that some information is erased after the execution of loops.\n"
|
||||||
"You can re-introduce information using require().";
|
"You can re-introduce information using require().";
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
@ -611,13 +611,13 @@ void SMTChecker::checkCondition(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
message << ".";
|
message << ".";
|
||||||
m_errorReporter.warning(_location, message.str() + conditionalComment);
|
m_errorReporter.warning(_location, message.str() + loopComment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case smt::CheckResult::UNSATISFIABLE:
|
case smt::CheckResult::UNSATISFIABLE:
|
||||||
break;
|
break;
|
||||||
case smt::CheckResult::UNKNOWN:
|
case smt::CheckResult::UNKNOWN:
|
||||||
m_errorReporter.warning(_location, _description + " might happen here." + conditionalComment);
|
m_errorReporter.warning(_location, _description + " might happen here." + loopComment);
|
||||||
break;
|
break;
|
||||||
case smt::CheckResult::ERROR:
|
case smt::CheckResult::ERROR:
|
||||||
m_errorReporter.warning(_location, "Error trying to invoke SMT solver.");
|
m_errorReporter.warning(_location, "Error trying to invoke SMT solver.");
|
||||||
|
@ -160,7 +160,7 @@ private:
|
|||||||
|
|
||||||
std::shared_ptr<smt::SolverInterface> m_interface;
|
std::shared_ptr<smt::SolverInterface> m_interface;
|
||||||
std::shared_ptr<VariableUsage> m_variableUsage;
|
std::shared_ptr<VariableUsage> m_variableUsage;
|
||||||
bool m_conditionalExecutionHappened = false;
|
bool m_loopExecutionHappened = false;
|
||||||
std::map<Expression const*, smt::Expression> m_expressions;
|
std::map<Expression const*, smt::Expression> m_expressions;
|
||||||
std::map<Declaration const*, SSAVariable> m_variables;
|
std::map<Declaration const*, SSAVariable> m_variables;
|
||||||
std::vector<smt::Expression> m_pathConditions;
|
std::vector<smt::Expression> m_pathConditions;
|
||||||
|
Loading…
Reference in New Issue
Block a user