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

Sebastian Redl sebastian.redl at getdesigned.at
Mon Mar 3 15:11:07 PST 2014


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.

Sebastian



More information about the cfe-commits mailing list