Closed
Description
This program:
fn main() {
let value: &u8 = unsafe { ::std::mem::zeroed() };
}
when compiled with opt-level
higher than zero generates a SIGILL. Switching to std::mem::uninitialized
works around the issue.
I've been bitten by this in generic code where I have a field with ManuallyDrop<T>
(basically I use it as an Option
with manually managed null state).
This is possibly related to #52875
Affected versions:
rustc 1.29.0-nightly (874dec2 2018-07-21)
rustc 1.29.0-nightly (54628c8 2018-07-30)
rustc 1.27.2 (58cc626 2018-07-18)
Not affected versions:
rustc 1.26.0 (a775680 2018-05-07)
This doesn't look architecture specific as x86_64-unknown-linux-gnu
, mips64-unknown-linux-gnuabi64
and armv7-unknown-linux-musleabihf
are all affected.