__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined on aarch64

Andrew Haley aph@redhat.com
Thu Jun 29 07:47:00 GMT 2017


On 28/06/17 22:22, Toebs Douglass wrote:
> On 28/06/17 18:36, Richard Earnshaw wrote:
>> thread2 is blissfully unaware of the fact that by using CAS directly on
>> 'a' it has broken the requirement in f() that an object must be locked
>> before it can be dereferenced.
> 
> I don't undestand, though; wouldn't this be something which falls wholly
> to the *user* to get right?  why is the compiler concerned?

Yes, it totally is.

> If I create a variable which I make thread safe with locks and then in
> one case I don't use those locks, this is my problem, not the compilers.
> 
> This matter with CAS/locks seems much the same.

Exactly.  The fact that people can mess up is no excuse for GCC not
providing an intrinsic for double-word CAS.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the Gcc-help mailing list