1 // `PrimVal`s in Miri are represented with 8 bytes (u64) and at the time of writing, the `-x`
2 // will sign extend into the entire 8 bytes. Then, if you tried to write the `-x` into
3 // something smaller than 8 bytes, like a 4 byte pointer, it would crash in byteorder crate
4 // code that assumed only the low 4 bytes would be set. Actually, we were masking properly for
5 // everything except pointers before I fixed it, so this was probably impossible to reproduce on
8 // This is just intended as a regression test to make sure we don't reintroduce this problem.
10 #[cfg(target_pointer_width = "32")]
12 use std::mem::transmute;
14 // Make the weird PrimVal.
16 let bad = unsafe { transmute::<i32, *const u8>(-x) };
18 // Force it through the Memory::write_primval code.
22 #[cfg(not(target_pointer_width = "32"))]