2023-05-27 13:52:14 -05:00
|
|
|
//@ run-pass
|
|
|
|
//@ compile-flags: -C debug-assertions
|
|
|
|
|
|
|
|
struct Misalignment {
|
|
|
|
a: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
|
|
|
|
unsafe {
|
2023-07-04 13:23:16 -05:00
|
|
|
let ptr: *const Misalignment = items.as_ptr().byte_add(1);
|
2023-05-27 13:52:14 -05:00
|
|
|
let _ptr = core::ptr::addr_of!((*ptr).a);
|
|
|
|
}
|
|
|
|
}
|