File tree Expand file tree Collapse file tree 8 files changed +39
-3
lines changed
regression/cbmc/self_loops_to_assumptions1 Expand file tree Collapse file tree 8 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --unwind 1 --unwinding-assertions
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
Original file line number Diff line number Diff line change 1+ int main ()
2+ {
3+ while (1 ) {}
4+
5+ return 0 ;
6+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --unwind 1 --unwinding-assertions --no-self-loops-to-assumptions
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ ^VERIFICATION FAILED$
7+ --
Original file line number Diff line number Diff 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)
@@ -303,6 +305,7 @@ class path_explorert : public bmct
303305 " (unwinding-assertions)" \
304306 " (no-unwinding-assertions)" \
305307 " (no-pretty-names)" \
308+ " (no-self-loops-to-assumptions)" \
306309 " (partial-loops)" \
307310 " (paths)" \
308311 " (depth):" \
@@ -323,6 +326,8 @@ class path_explorert : public bmct
323326 " --slice-formula remove assignments unrelated to property\n " \
324327 " --unwinding-assertions generate unwinding assertions\n " \
325328 " --partial-loops permit paths with partial loops\n " \
329+ " --no-self-loops-to-assumptions \
330+ " do not simplify while (1 ) {} to assume (false ) \
326331 " --no-pretty-names do not simplify identifiers\n" \
327332 " --graphml-witness filename write the witness in GraphML format to " \
328333 "filename\n" // NOLINT(*)
Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ 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+ options.set_option (
192+ " self-loops-to-assumptions" , cmdline.isset (" no-self-loops-to-assumptions" ));
193+
190194 // all checks supported by goto_check
191195 PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
192196
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -154,6 +154,10 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
154154 else
155155 options.set_option (" propagation" , true );
156156
157+ // transform self loops to assumptions
158+ options.set_option (
159+ " self-loops-to-assumptions" , cmdline.isset (" no-self-loops-to-assumptions" ));
160+
157161 // all checks supported by goto_check
158162 PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
159163
You can’t perform that action at this time.
0 commit comments