summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/alignment/misaligned_lhs.rs
blob: 97644ba8e0949482da839774e0cd4601e2674f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-fail
// ignore-wasm32-bare: No panic messages
// ignore-i686-pc-windows-msvc: #112480
// compile-flags: -C debug-assertions
// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is

fn main() {
    let mut x = [0u32; 2];
    let ptr = x.as_mut_ptr();
    unsafe {
        *(ptr.byte_add(1)) = 42;
    }
}