rust/tests/pass/disable-alignment-check.rs
2022-07-08 16:08:32 +00:00

12 lines
282 B
Rust

//@compile-flags: -Zmiri-disable-alignment-check
fn main() {
let mut x = [0u8; 20];
let x_ptr: *mut u8 = x.as_mut_ptr();
// At least one of these is definitely unaligned.
unsafe {
*(x_ptr as *mut u64) = 42;
*(x_ptr.add(1) as *mut u64) = 42;
}
}