File tree 8 files changed +39
-3
lines changed
regression/cbmc/self_loops_to_assumptions1
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
90
90
symex.constant_propagation =options.get_bool_option (" propagation" );
91
91
symex.record_coverage =
92
92
!options.get_option (" symex-coverage-report" ).empty ();
93
+ symex.self_loops_to_assumptions =
94
+ options.get_bool_option (" self-loops-to-assumptions" );
93
95
}
94
96
95
97
virtual resultt run (const goto_functionst &goto_functions)
@@ -303,6 +305,7 @@ class path_explorert : public bmct
303
305
" (unwinding-assertions)" \
304
306
" (no-unwinding-assertions)" \
305
307
" (no-pretty-names)" \
308
+ " (no-self-loops-to-assumptions)" \
306
309
" (partial-loops)" \
307
310
" (paths)" \
308
311
" (depth):" \
@@ -323,6 +326,8 @@ class path_explorert : public bmct
323
326
" --slice-formula remove assignments unrelated to property\n " \
324
327
" --unwinding-assertions generate unwinding assertions\n " \
325
328
" --partial-loops permit paths with partial loops\n " \
329
+ " --no-self-loops-to-assumptions \
330
+ " do not simplify while (1 ) {} to assume (false ) \
326
331
" --no-pretty-names do not simplify identifiers\n" \
327
332
" --graphml-witness filename write the witness in GraphML format to " \
328
333
"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)
187
187
else
188
188
options.set_option (" propagation" , true );
189
189
190
+ // transform self loops to assumptions
191
+ options.set_option (
192
+ " self-loops-to-assumptions" , cmdline.isset (" no-self-loops-to-assumptions" ));
193
+
190
194
// all checks supported by goto_check
191
195
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
192
196
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ class goto_symext
74
74
: total_vccs(0 ),
75
75
remaining_vccs (0 ),
76
76
constant_propagation(true ),
77
+ self_loops_to_assumptions(true ),
77
78
language_mode(),
78
79
outer_symbol_table(outer_symbol_table),
79
80
ns(outer_symbol_table),
@@ -210,6 +211,7 @@ class goto_symext
210
211
unsigned total_vccs, remaining_vccs;
211
212
212
213
bool constant_propagation;
214
+ bool self_loops_to_assumptions;
213
215
214
216
optionst options;
215
217
Original file line number Diff line number Diff line change @@ -58,9 +58,10 @@ 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 (self_loops_to_assumptions &&
62
+ (goto_target==state.source .pc ||
63
+ (instruction.incoming_edges .size ()==1 &&
64
+ *instruction.incoming_edges .begin ()==goto_target)))
64
65
{
65
66
// generate assume(false) or a suitable negation if this
66
67
// 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)
154
154
else
155
155
options.set_option (" propagation" , true );
156
156
157
+ // transform self loops to assumptions
158
+ options.set_option (
159
+ " self-loops-to-assumptions" , cmdline.isset (" no-self-loops-to-assumptions" ));
160
+
157
161
// all checks supported by goto_check
158
162
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
159
163
You can’t perform that action at this time.
0 commit comments