File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed
regression/goto-synthesizer/empty_loop
goto-instrument/contracts Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ void exit (int s )
2+ {
3+ _EXIT :
4+ goto _EXIT ;
5+ }
6+
7+ int main ()
8+ {
9+ exit (1 );
10+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --pointer-check
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ --
9+ Check if empty loops are correctly skipped.
Original file line number Diff line number Diff line change @@ -869,7 +869,8 @@ void code_contractst::apply_loop_contract(
869869 for (const auto &loop_head_and_content : natural_loops.loop_map)
870870 {
871871 const auto &loop_content = loop_head_and_content.second ;
872- if (loop_content.empty ())
872+ // Skip empty loops and self-looped node.
873+ if (loop_content.size () <= 1 )
873874 continue ;
874875
875876 auto loop_head = loop_head_and_content.first ;
Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ void enumerative_loop_contracts_synthesizert::init_candidates()
8888 // Initialize invariants for unannotated loops as true
8989 for (const auto &loop_head_and_content : natural_loops.loop_map )
9090 {
91+ // Ignore empty loops and self-looped node.
92+ if (loop_head_and_content.second .size () <= 1 )
93+ continue ;
94+
9195 goto_programt::const_targett loop_end =
9296 get_loop_end_from_loop_head_and_content (
9397 loop_head_and_content.first , loop_head_and_content.second );
You can’t perform that action at this time.
0 commit comments