diff --git a/src/base.rs b/src/base.rs index 0d43e20f1c1..75a0db5aadb 100644 --- a/src/base.rs +++ b/src/base.rs @@ -767,7 +767,10 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { NullOp::SizeOf => layout.size.bytes(), NullOp::AlignOf => layout.align.abi.bytes(), }; - let val = CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into()); + let val = CValue::by_val( + fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(val).unwrap()), + fx.layout_of(fx.tcx.types.usize), + ); lval.write_cvalue(fx, val); } Rvalue::Aggregate(ref kind, ref operands) => { diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 4166e763012..571af04f22c 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -1103,8 +1103,8 @@ fn codegen_regular_intrinsic_call<'tcx>( fx.bcx.ins().call_indirect(f_sig, f, &[data]); - let layout = ret.layout(); - let ret_val = CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size)); + let layout = fx.layout_of(fx.tcx.types.i32); + let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 0), layout); ret.write_cvalue(fx, ret_val); }