@@ -565,7 +565,7 @@ goto_programt::const_targett goto_program2codet::convert_goto(
565
565
else if (!target->guard .is_true ())
566
566
return convert_goto_switch (target, upper_bound, dest);
567
567
else if (!loop_last_stack.empty ())
568
- return convert_goto_break_continue (target, dest);
568
+ return convert_goto_break_continue (target, upper_bound, dest);
569
569
else
570
570
return convert_goto_goto (target, dest);
571
571
}
@@ -803,7 +803,14 @@ bool goto_program2codet::set_block_end_points(
803
803
804
804
// ignore dead instructions for the following checks
805
805
if (n.dominators .empty ())
806
+ {
807
+ // simplification may have figured out that a case is unreachable
808
+ // this is possibly getting too weird, abort to be safe
809
+ if (case_end==it->case_start )
810
+ return true ;
811
+
806
812
continue ;
813
+ }
807
814
808
815
// find the last instruction dominated by the case start
809
816
if (n.dominators .find (it->case_start )==n.dominators .end ())
@@ -1107,7 +1114,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_if(
1107
1114
upper_bound->location_number < end_if->location_number ))
1108
1115
{
1109
1116
if (!loop_last_stack.empty ())
1110
- return convert_goto_break_continue (target, dest);
1117
+ return convert_goto_break_continue (target, upper_bound, dest);
1111
1118
else
1112
1119
return convert_goto_goto (target, dest);
1113
1120
}
@@ -1140,6 +1147,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_if(
1140
1147
1141
1148
goto_programt::const_targett goto_program2codet::convert_goto_break_continue (
1142
1149
goto_programt::const_targett target,
1150
+ goto_programt::const_targett upper_bound,
1143
1151
codet &dest)
1144
1152
{
1145
1153
assert (!loop_last_stack.empty ());
@@ -1149,7 +1157,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_break_continue(
1149
1157
// 1: ...
1150
1158
goto_programt::const_targett next=target;
1151
1159
for (++next;
1152
- next!=goto_program.instructions .end ();
1160
+ next!=upper_bound && next!= goto_program.instructions .end ();
1153
1161
++next)
1154
1162
{
1155
1163
cfg_dominatorst::cfgt::entry_mapt::const_iterator i_entry=
0 commit comments