Skip to content

Commit

Permalink
remove_returns: do not lose location numbers
Browse files Browse the repository at this point in the history
Fully replacing an instruction would also invalidate its location
number. This isn't necessary here, and we also didn't run
compute_location_numbers after this change.
  • Loading branch information
tautschnig committed Feb 2, 2024
1 parent f034dbb commit a235b44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/goto-programs/remove_returns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void remove_returnst::replace_returns(

// now turn the `return' into `assignment'
auto labels = std::move(instruction.labels);
instruction = goto_programt::make_assignment(
assignment, instruction.source_location());
instruction.clear(goto_program_instruction_typet::ASSIGN);
instruction.code_nonconst() = std::move(assignment);
instruction.labels = std::move(labels);
}
else
Expand Down

0 comments on commit a235b44

Please sign in to comment.