rust/tests/run-pass/disable-alignment-check.rs
2020-04-13 17:58:03 +02: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;
}
}