Skip to content

Commit e362c86

Browse files
committed
Run goto_program.update() after adding instructions
remove_returnst::do_function_calls may introduce new instructions. Doing so requires a call to goto_programt::update to ensure instruction numbers are assigned.
1 parent 11e9394 commit e362c86

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/goto-programs/remove_returns.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ void remove_returnst::do_function_calls(
145145
function_is_stubt function_is_stub,
146146
goto_programt &goto_program)
147147
{
148+
bool requires_update = false;
149+
148150
Forall_goto_program_instructions(i_it, goto_program)
149151
{
150152
if(i_it->is_function_call())
@@ -220,10 +222,15 @@ void remove_returnst::do_function_calls(
220222
t_a,
221223
goto_programt::make_dead(*return_value, i_it->source_location));
222224
}
225+
226+
requires_update = true;
223227
}
224228
}
225229
}
226230
}
231+
232+
if(requires_update)
233+
goto_program.update();
227234
}
228235

229236
void remove_returnst::operator()(goto_functionst &goto_functions)

0 commit comments

Comments
 (0)