Execute with Miri:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7e7d31feebbea4c3caceaccff1fa6bac
The problem is that
|
// Bump the unaligned offset up to the appropriate alignment |
|
let offset = round_up_const_value_to_alignment(bx, unaligned_offset, unsized_align); |
and
|
(base.meta, offset.align_to(align)) |
do not take the reduced field alignment into account and calculate the offset as-if the standard alignment was in place.
Execute with Miri:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7e7d31feebbea4c3caceaccff1fa6bac
The problem is that
rust/compiler/rustc_codegen_ssa/src/mir/place.rs
Lines 181 to 182 in 6526e5c
rust/compiler/rustc_mir/src/interpret/place.rs
Line 413 in 6526e5c