Skip to content

Commit 8254ba2

Browse files
Add --incremental-loop to CBMC
for incremental unwinding and assertion checking of a specified loop.
1 parent 417c559 commit 8254ba2

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ add_subdirectory(goto-instrument)
3131
add_subdirectory(cpp)
3232
add_subdirectory(cbmc-concurrency)
3333
add_subdirectory(cbmc-cover)
34+
add_subdirectory(cbmc-incr-oneloop)
3435
add_subdirectory(goto-instrument-typedef)
3536
add_subdirectory(smt2_solver)
3637
add_subdirectory(smt2_strings)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ DIRS = cbmc \
99
cpp \
1010
cbmc-concurrency \
1111
cbmc-cover \
12+
cbmc-incr-oneloop \
1213
goto-instrument-typedef \
1314
smt2_solver \
1415
smt2_strings \

src/cbmc/cbmc_parse_options.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Author: Daniel Kroening, [email protected]
4141
#include <goto-checker/multi_path_symex_checker.h>
4242
#include <goto-checker/multi_path_symex_only_checker.h>
4343
#include <goto-checker/properties.h>
44+
#include <goto-checker/single_loop_incremental_symex_checker.h>
4445
#include <goto-checker/single_path_symex_checker.h>
4546
#include <goto-checker/single_path_symex_only_checker.h>
4647
#include <goto-checker/stop_on_fail_verifier.h>
@@ -335,6 +336,29 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
335336
"max-node-refinement",
336337
cmdline.get_value("max-node-refinement"));
337338

339+
if(cmdline.isset("incremental-loop"))
340+
{
341+
options.set_option(
342+
"incremental-loop", cmdline.get_value("incremental-loop"));
343+
options.set_option("refine", true);
344+
options.set_option("refine-arrays", true);
345+
346+
if(cmdline.isset("unwind-min"))
347+
options.set_option("unwind-min", cmdline.get_value("unwind-min"));
348+
349+
if(cmdline.isset("unwind-max"))
350+
options.set_option("unwind-max", cmdline.get_value("unwind-max"));
351+
352+
if(cmdline.isset("ignore-properties-before-unwind-min"))
353+
options.set_option("ignore-properties-before-unwind-min", true);
354+
355+
if(cmdline.isset("paths"))
356+
{
357+
error() << "--paths not supported with --incremental-loop" << eom;
358+
exit(CPROVER_EXIT_USAGE_ERROR);
359+
}
360+
}
361+
338362
// SMT Options
339363

340364
if(cmdline.isset("smt1"))
@@ -613,7 +637,22 @@ int cbmc_parse_optionst::doit()
613637

614638
std::unique_ptr<goto_verifiert> verifier = nullptr;
615639

616-
if(
640+
if(options.is_set("incremental-loop"))
641+
{
642+
if(options.get_bool_option("stop-on-fail"))
643+
{
644+
verifier = util_make_unique<
645+
stop_on_fail_verifiert<single_loop_incremental_symex_checkert>>(
646+
options, ui_message_handler, goto_model);
647+
}
648+
else
649+
{
650+
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
651+
single_loop_incremental_symex_checkert>>(
652+
options, ui_message_handler, goto_model);
653+
}
654+
}
655+
else if(
617656
options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
618657
{
619658
verifier =

0 commit comments

Comments
 (0)