Closed sbarral closed 2 years ago
If flag_receiver.load(Acquire) == 2
then data_receiver.with(|p| p.read()) == 42
must hold regardless of the ordering of flag_interceptor.compare_exchange
.
http://open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4868.pdf
store
and compare_exchange
form a release sequence headed by the store
.
store
synchronizes with load
, because the load takes the value from the release sequence headed by store
.
@tomtomjhj Thank you very much for looking into this and for the detailed explanation.
Looks like my expectation was wrong then, I can only take solace in the fact that even the C++ reference authors apparently made the same flawed assumption ;-)
I guess we can close this report then?
Yeah I think this issue can be closed.
Hi,
First of all, thanks for this amazing tool.
While testing the acquire-release transitivity example from https://en.cppreference.com/w/cpp/atomic/memory_order, I noticed something peculiar:
loom
does not trigger the assert when the CAS uses relaxed ordering.loom
does generate branches where the assert is checked (i.e. where the receiver seesflag_receiver.load(Acquire) == 2
), but it never fires. I guess thatRelaxed
is indeed OK as CAS failure ordering, but I would have expected anything weaker thanAcqRel
for the CAS success to trigger the assert.