Skip to content

Commit e643804

Browse files
Mark-SimulacrumAmanieu
authored andcommitted
Avoid over-aligning the return value in the -Cpanic=abort case
1 parent b3a0899 commit e643804

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,10 @@ fn try_intrinsic(
858858
) {
859859
if bx.sess().no_landing_pads() {
860860
bx.call(func, &[data], None);
861-
let ptr_align = bx.tcx().data_layout.pointer_align.abi;
862-
bx.store(bx.const_null(bx.type_i8p()), dest, ptr_align);
861+
// Return 0 unconditionally from the intrinsic call;
862+
// we can never unwind.
863+
let ret_align = bx.tcx().data_layout.i32_align.abi;
864+
bx.store(bx.const_i32(0), dest, ret_align);
863865
} else if wants_msvc_seh(bx.sess()) {
864866
codegen_msvc_try(bx, func, data, local_ptr, dest);
865867
} else {

0 commit comments

Comments
 (0)