2022-11-10 10:37:28 -06:00
|
|
|
// run-fail
|
2023-03-30 22:46:44 -05:00
|
|
|
// ignore-wasm32-bare: No panic messages
|
2023-06-15 17:02:55 -05:00
|
|
|
// ignore-i686-pc-windows-msvc: #112480
|
2022-11-10 10:37:28 -06:00
|
|
|
// compile-flags: -C debug-assertions
|
|
|
|
// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
|
|
|
|
|
|
|
|
fn main() {
|
2023-07-04 13:23:16 -05:00
|
|
|
let x = [0u32; 2];
|
|
|
|
let ptr = x.as_ptr();
|
|
|
|
let mut dest = 0u32;
|
|
|
|
let dest_ptr = &mut dest as *mut u32;
|
2022-11-10 10:37:28 -06:00
|
|
|
unsafe {
|
2023-07-04 13:23:16 -05:00
|
|
|
*dest_ptr = *(ptr.byte_add(1));
|
2022-11-10 10:37:28 -06:00
|
|
|
}
|
|
|
|
}
|