]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/unaligned_pointers/atomic_unaligned.rs
Rollup merge of #102095 - oli-obk:simplify, r=TaKO8Ki
[rust.git] / src / tools / miri / tests / fail / unaligned_pointers / atomic_unaligned.rs
1 //@compile-flags: -Zmiri-symbolic-alignment-check
2 #![feature(core_intrinsics)]
3
4 fn main() {
5     // Do a 4-aligned u64 atomic access. That should be UB on all platforms,
6     // even if u64 only has alignment 4.
7     let z = [0u32; 2];
8     let zptr = &z as *const _ as *const u64;
9     unsafe {
10         ::std::intrinsics::atomic_load_seqcst(zptr);
11         //~^ERROR: accessing memory with alignment 4, but alignment 8 is required
12     }
13 }