mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] User timeout option
This commit is contained in:
@@ -27,14 +27,19 @@ using namespace std;
|
||||
using namespace solidity;
|
||||
using namespace solidity::smtutil;
|
||||
|
||||
Z3CHCInterface::Z3CHCInterface():
|
||||
m_z3Interface(make_unique<Z3Interface>()),
|
||||
Z3CHCInterface::Z3CHCInterface(optional<unsigned> _queryTimeout):
|
||||
CHCSolverInterface(_queryTimeout),
|
||||
m_z3Interface(make_unique<Z3Interface>(m_queryTimeout)),
|
||||
m_context(m_z3Interface->context()),
|
||||
m_solver(*m_context)
|
||||
{
|
||||
// These need to be set globally.
|
||||
z3::set_param("rewriter.pull_cheap_ite", true);
|
||||
z3::set_param("rlimit", Z3Interface::resourceLimit);
|
||||
|
||||
if (m_queryTimeout)
|
||||
m_context->set("timeout", int(*m_queryTimeout));
|
||||
else
|
||||
z3::set_param("rlimit", Z3Interface::resourceLimit);
|
||||
|
||||
setSpacerOptions();
|
||||
}
|
||||
@@ -97,7 +102,13 @@ pair<CheckResult, CHCSolverInterface::CexGraph> Z3CHCInterface::query(Expression
|
||||
}
|
||||
catch (z3::exception const& _err)
|
||||
{
|
||||
if (_err.msg() == string("max. resource limit exceeded"))
|
||||
set<string> msgs{
|
||||
/// Resource limit (rlimit) exhausted.
|
||||
"max. resource limit exceeded",
|
||||
/// User given timeout exhausted.
|
||||
"canceled"
|
||||
};
|
||||
if (msgs.count(_err.msg()))
|
||||
result = CheckResult::UNKNOWN;
|
||||
else
|
||||
result = CheckResult::ERROR;
|
||||
|
||||
Reference in New Issue
Block a user