https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104480

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> Nothing in your code imposes an ordering on those stores. Another thread
> cannot observe it, because you are using non-atomic operations.

To be more precise, another thread cannot even observe *one* of those stores
without a data race. It certainly can't observe both and conclude they happened
out of order.

To avoid a data race the other thread must ensure that the entire call to f
happens-before any read of either memory location. And if the entire call
happens-before the read, you can't see which order the stores happened in.

Reply via email to