Skip to content

Commit ed3502f

Browse files
committed
Make pointer max constant not overflow
1 parent 5cd848c commit ed3502f

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_codegen_ssa/src

1 file changed

+2
-1
lines changed

compiler/rustc_codegen_ssa/src/glue.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
4444
bx.const_usize(unit.size.bytes()),
4545
info.unwrap(),
4646
);
47+
let ptr_max = bx.data_layout().pointer_size.truncate(u128::MAX) as u64;
4748
(
48-
bx.select(overflow, bx.const_usize(u64::MAX), size),
49+
bx.select(overflow, bx.const_usize(ptr_max), size),
4950
bx.const_usize(unit.align.abi.bytes()),
5051
)
5152
}

0 commit comments

Comments
 (0)