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
// atomic loads can be implemented via compare_exchange on some targets. There could
1001
+
// possibly be some very specific exceptions to this, see
1002
+
// <https://github.com/rust-lang/miri/pull/2464#discussion_r939636130> for details.
1002
1003
// We avoid `get_ptr_alloc` since we do *not* want to run the access hooks -- the actual
1003
1004
// access will happen later.
1004
1005
let(alloc_id, _offset, _prov) =
1005
1006
this.ptr_try_get_alloc_id(place.ptr).expect("there are no zero-sized atomic accesses");
1006
1007
if this.get_alloc_mutability(alloc_id)? == Mutability::Not{
1007
-
throw_ub_format!("atomic operations cannot be performed on read-only memory");
1008
+
throw_ub_format!(
1009
+
"atomic operations cannot be performed on read-only memory\n\
1010
+
many platforms require atomic read-modify-write instructions to be performed on writeable memory, even if the operation fails \
1011
+
(and is hence nominally read-only)\n\
1012
+
some platforms implement (some) atomic loads via compare-exchange, which means they do not work on read-only memory; \
1013
+
it is possible that we could have an exception permitting this for specific kinds of loads so please report an issue at <https://github.com/rust-lang/miri/issues> if this is a problem for you"
0 commit comments