1 // Should not rely on the aliasing model for its failure.
2 //@compile-flags: -Zmiri-disable-stacked-borrows
4 use std::sync::atomic::{AtomicI32, Ordering};
8 let x = &X as *const i32 as *const AtomicI32;
9 let x = unsafe { &*x };
10 x.compare_exchange(1, 2, Ordering::Relaxed, Ordering::Relaxed).unwrap_err(); //~ERROR: atomic operations cannot be performed on read-only memory