mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add optional bounds to unroll loops in BMC model checker
This commit is contained in:
@@ -76,6 +76,7 @@ static string const g_strModelCheckerShowUnsupported = "model-checker-show-unsup
|
||||
static string const g_strModelCheckerSolvers = "model-checker-solvers";
|
||||
static string const g_strModelCheckerTargets = "model-checker-targets";
|
||||
static string const g_strModelCheckerTimeout = "model-checker-timeout";
|
||||
static string const g_strModelCheckerBMCLoopIterations = "model-checker-bmc-loop-iterations";
|
||||
static string const g_strNone = "none";
|
||||
static string const g_strNoOptimizeYul = "no-optimize-yul";
|
||||
static string const g_strOptimize = "optimize";
|
||||
@@ -861,17 +862,23 @@ General Information)").c_str(),
|
||||
(
|
||||
g_strModelCheckerTargets.c_str(),
|
||||
po::value<string>()->value_name("default,all,constantCondition,underflow,overflow,divByZero,balance,assert,popEmptyArray,outOfBounds")->default_value("default"),
|
||||
"Select model checker verification targets. "
|
||||
"Select model checker verification targets."
|
||||
"Multiple targets can be selected at the same time, separated by a comma and no spaces."
|
||||
" By default all targets except underflow and overflow are selected."
|
||||
)
|
||||
(
|
||||
g_strModelCheckerTimeout.c_str(),
|
||||
po::value<unsigned>()->value_name("ms"),
|
||||
"Set model checker timeout per query in milliseconds. "
|
||||
"The default is a deterministic resource limit. "
|
||||
"Set model checker timeout per query in milliseconds."
|
||||
"The default is a deterministic resource limit."
|
||||
"A timeout of 0 means no resource/time restrictions for any query."
|
||||
)
|
||||
(
|
||||
g_strModelCheckerBMCLoopIterations.c_str(),
|
||||
po::value<unsigned>(),
|
||||
"Set loop unrolling depth for BMC engine."
|
||||
"Default is 1."
|
||||
)
|
||||
;
|
||||
desc.add(smtCheckerOptions);
|
||||
|
||||
@@ -965,6 +972,7 @@ void CommandLineParser::processArgs()
|
||||
{g_strModelCheckerInvariants, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerSolvers, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerTimeout, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerBMCLoopIterations, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerContracts, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerTargets, {InputMode::Compiler, InputMode::CompilerWithASTImport}}
|
||||
};
|
||||
@@ -1337,6 +1345,13 @@ void CommandLineParser::processArgs()
|
||||
if (m_args.count(g_strModelCheckerTimeout))
|
||||
m_options.modelChecker.settings.timeout = m_args[g_strModelCheckerTimeout].as<unsigned>();
|
||||
|
||||
if (m_args.count(g_strModelCheckerBMCLoopIterations))
|
||||
{
|
||||
if (!m_options.modelChecker.settings.engine.bmc)
|
||||
solThrow(CommandLineValidationError, "BMC loop unrolling requires the BMC engine to be enabled");
|
||||
m_options.modelChecker.settings.bmcLoopIterations = m_args[g_strModelCheckerBMCLoopIterations].as<unsigned>();
|
||||
}
|
||||
|
||||
m_options.metadata.literalSources = (m_args.count(g_strMetadataLiteral) > 0);
|
||||
m_options.modelChecker.initialize =
|
||||
m_args.count(g_strModelCheckerContracts) ||
|
||||
|
||||
Reference in New Issue
Block a user