Skip to content

Commit 460e664

Browse files
committed
mir: Store immediates used for indirect arguments in an alloca.
1 parent 473f804 commit 460e664

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_trans/trans/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
410410

411411
// Force by-ref if we have to load through a cast pointer.
412412
let (mut llval, by_ref) = match val {
413-
Immediate(llval) if arg.cast.is_some() => {
413+
Immediate(llval) if arg.is_indirect() || arg.cast.is_some() => {
414414
let llscratch = build::AllocaFcx(bcx.fcx(), arg.original_ty, "arg");
415415
bcx.store(llval, llscratch);
416416
(llscratch, true)

0 commit comments

Comments
 (0)