Skip to content

Commit 7dc47a4

Browse files
Remove unused case of return assignment in symex
The return instructions should have been removed by return-value removal, so they should not reach symex. We replace this case by an unreachable statement and remove the method that is now unused.
1 parent afc4663 commit 7dc47a4

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

src/goto-symex/goto_symex.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ class goto_symext
275275

276276
virtual void loop_bound_exceeded(statet &, const exprt &guard);
277277

278-
/// Assuming the program counter of \p state is currently pointing to a return
279-
/// instruction, assign the value in that return to the top frame's
280-
/// \p return_value field.
281-
void return_assignment(statet &);
282-
283278
virtual void no_body(const irep_idt &)
284279
{
285280
}

src/goto-symex/symex_function_call.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -447,28 +447,3 @@ static void locality(
447447
}
448448
}
449449

450-
void goto_symext::return_assignment(statet &state)
451-
{
452-
framet &frame = state.top();
453-
454-
const goto_programt::instructiont &instruction=*state.source.pc;
455-
PRECONDITION(instruction.is_return());
456-
const code_returnt &code = instruction.get_return();
457-
458-
target.location(state.guard.as_expr(), state.source);
459-
460-
PRECONDITION(code.operands().size() == 1 || frame.return_value.is_nil());
461-
462-
exprt value = code.return_value();
463-
464-
if(frame.return_value.is_not_nil())
465-
{
466-
code_assignt assignment(frame.return_value, value);
467-
468-
INVARIANT(
469-
base_type_eq(assignment.lhs().type(), assignment.rhs().type(), ns),
470-
"goto_symext::return_assignment type mismatch");
471-
472-
symex_assign(state, assignment);
473-
}
474-
}

src/goto-symex/symex_main.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,8 @@ void goto_symext::symex_step(
441441
break;
442442

443443
case RETURN:
444-
if(!state.guard.is_false())
445-
return_assignment(state);
446-
447-
symex_transition(state);
444+
// This case should have been removed by return-value removal
445+
UNREACHABLE;
448446
break;
449447

450448
case ASSIGN:

0 commit comments

Comments
 (0)