Skip to content

Commit 791bc62

Browse files
peterschrammeltautschnig
authored andcommitted
Add option not to transform self-loops into assumes
This allow disabling an optimisation in goto-symex which is not compatible with termination checking.
1 parent a695814 commit 791bc62

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

src/cbmc/bmc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class bmct:public safety_checkert
9090
symex.constant_propagation=options.get_bool_option("propagation");
9191
symex.record_coverage=
9292
!options.get_option("symex-coverage-report").empty();
93+
symex.self_loops_to_assumptions=
94+
options.get_bool_option("self-loops-to-assumptions");
9395
}
9496

9597
virtual resultt run(const goto_functionst &goto_functions)

src/cbmc/cbmc_parse_options.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
187187
else
188188
options.set_option("propagation", true);
189189

190+
// transform self loops to assumptions
191+
if(cmdline.isset("no-self-loops-to-assumptions"))
192+
options.set_option("self-loops-to-assumptions", false);
193+
else
194+
options.set_option("self-loops-to-assumptions", true);
195+
190196
// all checks supported by goto_check
191197
PARSE_OPTIONS_GOTO_CHECK(cmdline, options);
192198

src/cbmc/cbmc_parse_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class optionst;
7171
"(arrays-uf-always)(arrays-uf-never)" \
7272
"(string-abstraction)(no-arch)(arch):" \
7373
"(round-to-nearest)(round-to-plus-inf)(round-to-minus-inf)(round-to-zero)" \
74+
"(graphml-witness):" \
75+
"(no-self-loops-to-assumptions)" \
7476
"(localize-faults)(localize-faults-method):" \
7577
OPT_GOTO_TRACE \
7678
"(claim):(show-claims)(fixedbv)(floatbv)(all-claims)(all-properties)" // legacy, and will eventually disappear // NOLINT(whitespace/line_length)

src/goto-symex/goto_symex.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class goto_symext
7474
: total_vccs(0),
7575
remaining_vccs(0),
7676
constant_propagation(true),
77+
self_loops_to_assumptions(true),
7778
language_mode(),
7879
outer_symbol_table(outer_symbol_table),
7980
ns(outer_symbol_table),
@@ -210,6 +211,7 @@ class goto_symext
210211
unsigned total_vccs, remaining_vccs;
211212

212213
bool constant_propagation;
214+
bool self_loops_to_assumptions;
213215

214216
optionst options;
215217

src/goto-symex/symex_goto.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ void goto_symext::symex_goto(statet &state)
5858
if(!forward) // backwards?
5959
{
6060
// is it label: goto label; or while(cond); - popular in SV-COMP
61-
if(goto_target==state.source.pc ||
62-
(instruction.incoming_edges.size()==1 &&
63-
*instruction.incoming_edges.begin()==goto_target))
61+
if(self_loops_to_assumptions &&
62+
(goto_target==state.source.pc ||
63+
(instruction.incoming_edges.size()==1 &&
64+
*instruction.incoming_edges.begin()==goto_target)))
6465
{
6566
// generate assume(false) or a suitable negation if this
6667
// instruction is a conditional goto

0 commit comments

Comments
 (0)