File tree 8 files changed +44
-3
lines changed
regression/cbmc/self_loops_to_assumptions1
8 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
152
152
else
153
153
options.set_option (" propagation" , true );
154
154
155
+ // transform self loops to assumptions
156
+ options.set_option (
157
+ " self-loops-to-assumptions" ,
158
+ !cmdline.isset (" no-self-loops-to-assumptions" ));
159
+
155
160
// all checks supported by goto_check
156
161
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
157
162
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
+ }
6
+
7
+ return 0 ;
8
+ }
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 @@ -84,6 +84,8 @@ class bmct:public safety_checkert
84
84
symex.constant_propagation =options.get_bool_option (" propagation" );
85
85
symex.record_coverage =
86
86
!options.get_option (" symex-coverage-report" ).empty ();
87
+ symex.self_loops_to_assumptions =
88
+ options.get_bool_option (" self-loops-to-assumptions" );
87
89
}
88
90
89
91
virtual resultt run (const goto_functionst &goto_functions)
@@ -292,6 +294,7 @@ class path_explorert : public bmct
292
294
" (unwinding-assertions)" \
293
295
" (no-unwinding-assertions)" \
294
296
" (no-pretty-names)" \
297
+ " (no-self-loops-to-assumptions)" \
295
298
" (partial-loops)" \
296
299
" (paths):" \
297
300
" (show-symex-strategies)" \
@@ -315,6 +318,8 @@ class path_explorert : public bmct
315
318
" --unwinding-assertions generate unwinding assertions (cannot be\n " \
316
319
" used with --cover or --partial-loops)\n " \
317
320
" --partial-loops permit paths with partial loops\n " \
321
+ " --no-self-loops-to-assumptions\n " \
322
+ " do not simplify while(1){} to assume(0)\n " \
318
323
" --no-pretty-names do not simplify identifiers\n " \
319
324
" --graphml-witness filename write the witness in GraphML format to " \
320
325
" filename\n " // NOLINT(*)
Original file line number Diff line number Diff line change @@ -227,6 +227,11 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
227
227
if (cmdline.isset (" no-propagation" ))
228
228
options.set_option (" propagation" , false );
229
229
230
+ // transform self loops to assumptions
231
+ options.set_option (
232
+ " self-loops-to-assumptions" ,
233
+ !cmdline.isset (" no-self-loops-to-assumptions" ));
234
+
230
235
// all checks supported by goto_check
231
236
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
232
237
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class goto_symext
57
57
total_vccs (0 ),
58
58
remaining_vccs(0 ),
59
59
constant_propagation(true ),
60
+ self_loops_to_assumptions(true ),
60
61
language_mode(),
61
62
outer_symbol_table(outer_symbol_table),
62
63
ns(outer_symbol_table),
@@ -202,6 +203,7 @@ class goto_symext
202
203
unsigned total_vccs, remaining_vccs;
203
204
204
205
bool constant_propagation;
206
+ bool self_loops_to_assumptions;
205
207
206
208
optionst options;
207
209
Original file line number Diff line number Diff line change @@ -58,9 +58,11 @@ void goto_symext::symex_goto(statet &state)
58
58
if (!forward) // backwards?
59
59
{
60
60
// 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 (
62
+ self_loops_to_assumptions &&
63
+ (goto_target == state.source .pc ||
64
+ (instruction.incoming_edges .size () == 1 &&
65
+ *instruction.incoming_edges .begin () == goto_target)))
64
66
{
65
67
// generate assume(false) or a suitable negation if this
66
68
// instruction is a conditional goto
You can’t perform that action at this time.
0 commit comments