Skip to content

Commit 51ac2af

Browse files
committed
interpret: clobber return place when calling function
1 parent 11663b1 commit 51ac2af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

+4
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
676676
return_to_block: StackPopCleanup,
677677
) -> InterpResult<'tcx> {
678678
trace!("body: {:#?}", body);
679+
// Clobber previous return place contents, nobody is supposed to be able to see them any more
680+
// This also checks dereferenceable, but not align. We rely on all constructed places being
681+
// sufficiently aligned (in particular we rely on `deref_operand` checking alignment).
682+
self.write_uninit(return_place)?;
679683
// first push a stack frame so we have access to the local substs
680684
let pre_frame = Frame {
681685
body,

0 commit comments

Comments
 (0)