Skip to content

Commit 66e0b75

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 406b516 commit 66e0b75

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())
@@ -221,10 +223,15 @@ void remove_returnst::do_function_calls(
221223
t_d->source_location=i_it->source_location;
222224
t_d->code = code_deadt(*return_value);
223225
}
226+
227+
requires_update = true;
224228
}
225229
}
226230
}
227231
}
232+
233+
if(requires_update)
234+
goto_program.update();
228235
}
229236

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

0 commit comments

Comments
 (0)