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(
869
869
for (const auto &loop_head_and_content : natural_loops.loop_map)
870
870
{
871
871
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 )
873
874
continue ;
874
875
875
876
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()
88
88
// Initialize invariants for unannotated loops as true
89
89
for (const auto &loop_head_and_content : natural_loops.loop_map )
90
90
{
91
+ // Ignore empty loops and self-looped node.
92
+ if (loop_head_and_content.second .size () <= 1 )
93
+ continue ;
94
+
91
95
goto_programt::const_targett loop_end =
92
96
get_loop_end_from_loop_head_and_content (
93
97
loop_head_and_content.first , loop_head_and_content.second );
You can’t perform that action at this time.
0 commit comments