From a235b449d39bda7ded1038d29103039e543565b4 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Fri, 2 Feb 2024 13:36:30 +0000 Subject: [PATCH] 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. --- src/goto-programs/remove_returns.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/goto-programs/remove_returns.cpp b/src/goto-programs/remove_returns.cpp index f92f07358aa..56381490a53 100644 --- a/src/goto-programs/remove_returns.cpp +++ b/src/goto-programs/remove_returns.cpp @@ -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