File tree 4 files changed +50
-0
lines changed 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,12 @@ int bmct::do_language_agnostic_bmc(
588
588
if (driver_configure_bmc)
589
589
driver_configure_bmc (bmc, symbol_table);
590
590
tmp_result = bmc.run (model);
591
+
592
+ if (
593
+ tmp_result == safety_checkert::resultt::UNSAFE &&
594
+ opts.get_bool_option (" halt-symex-on-bug" ))
595
+ return CPROVER_EXIT_VERIFICATION_UNSAFE;
596
+
591
597
if (tmp_result != safety_checkert::resultt::PAUSED)
592
598
final_result = tmp_result;
593
599
}
@@ -637,6 +643,12 @@ int bmct::do_language_agnostic_bmc(
637
643
if (driver_configure_bmc)
638
644
driver_configure_bmc (pe, symbol_table);
639
645
tmp_result = pe.run (model);
646
+
647
+ if (
648
+ tmp_result == safety_checkert::resultt::UNSAFE &&
649
+ opts.get_bool_option (" halt-symex-on-bug" ))
650
+ return CPROVER_EXIT_VERIFICATION_UNSAFE;
651
+
640
652
if (tmp_result != safety_checkert::resultt::PAUSED)
641
653
final_result &= tmp_result;
642
654
worklist->pop ();
Original file line number Diff line number Diff line change @@ -304,6 +304,7 @@ class path_explorert : public bmct
304
304
" (no-pretty-names)" \
305
305
" (no-self-loops-to-assumptions)" \
306
306
" (partial-loops)" \
307
+ " (halt-symex-on-bug)" \
307
308
" (paths):" \
308
309
" (show-symex-strategies)" \
309
310
" (depth):" \
@@ -326,6 +327,7 @@ class path_explorert : public bmct
326
327
" --unwinding-assertions generate unwinding assertions (cannot be\n " \
327
328
" used with --cover or --partial-loops)\n " \
328
329
" --partial-loops permit paths with partial loops\n " \
330
+ " --halt-symex-on-bug with --paths, halt on first buggy path\n " \
329
331
" --no-self-loops-to-assumptions\n " \
330
332
" do not simplify while(1){} to assume(0)\n " \
331
333
" --no-pretty-names do not simplify identifiers\n " \
Original file line number Diff line number Diff line change @@ -98,6 +98,9 @@ void path_strategy_choosert::set_path_strategy_options(
98
98
exit (CPROVER_EXIT_USAGE_ERROR);
99
99
}
100
100
options.set_option (" exploration-strategy" , strategy);
101
+
102
+ if (cmdline.isset (" halt-symex-on-bug" ))
103
+ options.set_option (" halt-symex-on-bug" , true );
101
104
}
102
105
else
103
106
options.set_option (" exploration-strategy" , default_strategy ());
Original file line number Diff line number Diff line change @@ -223,6 +223,39 @@ SCENARIO("path strategies")
223
223
symex_eventt::resume (symex_eventt::enumt::JUMP, 9 ),
224
224
symex_eventt::result (symex_eventt::enumt::FAILURE),
225
225
});
226
+
227
+ GIVEN (" program to check for halt-symex-on-bug" )
228
+ {
229
+ std::function<void (optionst &)> halt_callback = [](optionst &opts) {
230
+ opts.set_option (" halt-symex-on-bug" , true );
231
+ };
232
+ std::function<void (optionst &)> no_halt_callback = [](optionst &opts) {};
233
+
234
+ c =
235
+ " /* 1 */ int main() \n "
236
+ " /* 2 */ { \n "
237
+ " /* 3 */ int x, y; \n "
238
+ " /* 4 */ if(x) \n "
239
+ " /* 5 */ y = 5 / 0; \n "
240
+ " /* 6 */ else \n "
241
+ " /* 7 */ y = 5 / 0; \n "
242
+ " /* 8 */ } \n " ;
243
+
244
+ check_with_strategy (
245
+ " lifo" ,
246
+ no_halt_callback,
247
+ c,
248
+ {symex_eventt::resume (symex_eventt::enumt::NEXT, 4 ),
249
+ symex_eventt::result (symex_eventt::enumt::FAILURE),
250
+ symex_eventt::resume (symex_eventt::enumt::NEXT, 6 ),
251
+ symex_eventt::result (symex_eventt::enumt::FAILURE)});
252
+ check_with_strategy (
253
+ " lifo" ,
254
+ halt_callback,
255
+ c,
256
+ {symex_eventt::resume (symex_eventt::enumt::NEXT, 4 ),
257
+ symex_eventt::result (symex_eventt::enumt::FAILURE)});
258
+ }
226
259
}
227
260
}
228
261
You can’t perform that action at this time.
0 commit comments