Skip to content

Commit a235b44

Browse files
committed
remove_returns: do not lose location numbers
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.
1 parent f034dbb commit a235b44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/goto-programs/remove_returns.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ void remove_returnst::replace_returns(
130130

131131
// now turn the `return' into `assignment'
132132
auto labels = std::move(instruction.labels);
133-
instruction = goto_programt::make_assignment(
134-
assignment, instruction.source_location());
133+
instruction.clear(goto_program_instruction_typet::ASSIGN);
134+
instruction.code_nonconst() = std::move(assignment);
135135
instruction.labels = std::move(labels);
136136
}
137137
else

0 commit comments

Comments
 (0)