Skip to content

Commit 213bb87

Browse files
committed
explicitly end va_list lifetime
1 parent 0027511 commit 213bb87

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_codegen_ssa/src/mir

1 file changed

+3
-0
lines changed

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
519519
match self.locals[mir::Local::from_usize(1 + va_list_arg_idx)] {
520520
LocalRef::Place(va_list) => {
521521
bx.va_end(va_list.val.llval);
522+
523+
// Explicitly end the lifetime of the `va_list`, this matters for LLVM.
524+
bx.lifetime_end(va_list.val.llval, va_list.layout.size);
522525
}
523526
_ => bug!("C-variadic function must have a `VaList` place"),
524527
}

0 commit comments

Comments
 (0)