[PATCH] IRGen: __c11/__atomic compare-and-exchange should respect the standard

Richard Smith richard at metafoo.co.uk
Mon Mar 3 15:47:09 PST 2014


On Mon, Mar 3, 2014 at 3:11 PM, Sebastian Redl <
sebastian.redl at getdesigned.at> wrote:

>
> On Mar 3, 2014, at 22:59, Richard Smith wrote:
>
> > OK, so... the standard does imply that the 'expected' access is
> non-atomic, which means that the case described in PR18899 already contains
> a data race (between the load of 'expected' in the
> __atomic_compare_exchange and the hypothesized store in another thread)
>
> The case I described there doesn't contain a race, because the memory
> location in question isn't visible to any other threads until the
> compare_exchange succeeds. The load from 'expected' happens-before the
> successful write, which synchronizes-with any load from the atomic in
> another thread that makes the memory location of 'expected' visible to
> another thread.


Yes, you're quite right =)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140303/8e287d48/attachment.html>


More information about the cfe-commits mailing list