[cpp-threads] Review of N2995 and resulting email threads
Peter Dimov
pdimov at mmltd.net
Sat Oct 24 16:39:34 BST 2009
Paul E. McKenney wrote:
> Hello!
>
> It was suggested that I review N2995 and the related email threads and
> comment appropriately.
...
> o 1.10p4: Add note:
>
> [Note: Atomic and locking objects are not trivially
> copyable [3.9], so executions that access atomic
> or locking objects as non-atomic objects, for example
> through an array of character type, will have undefined
> behaviour - end note]
>
> --- I believe that this is straightforward enough to qualify
> --- as editorial.
I still think that this note is incorrect, as there are ways to read an
atomic object without UB. In fact, you acknowledge this objection of mine
in:
> o 1.10p14: Use of casts or unions can result in atomic and
> non-atomic accesses to the same memory location, so the "at least
> one of which is not atomic" must remain. Peter Dimov pointed out
> that memcpy() can have the same effect. Therefore, I am -not-
> OK with the suggested modifications to the first sentence --
> if any of the accesses are non-atomic, there can be a data race.
> It is not necessary for -all- of them to be non-atomic.
More information about the cpp-threads
mailing list