You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::sync::atomic::{AtomicI32,Ordering};fnmain(){let x = &AtomicI32::new(0);let y = x as*constAtomicI32as*consti32;let y = unsafe{&*y };
x.compare_exchange(1,2,Ordering::Relaxed,Ordering::Relaxed).unwrap_err();let _val = y;}
Right now Miri accepts this, since the failed RMW is just considered a read by the aliasing model. But maybe it should be considered a write? We almost certainly want to disallow it on read-only memory since that pagefaults on x86, so making it a write also for other concerns seems more consistent.
OTOH, that could mean that a failing RMW that races with a non-atomic read might be considered a data race, and I am not sure if that is the right semantics.
Thanks to @chorman0773 for bringing up the question.