"memory" clobber in synchronization primitives
Geoff Keating
geoffk@ozemail.com.au
Wed Sep 9 03:26:00 GMT 1998
> Date: Wed, 9 Sep 1998 01:29:21 -0700
> From: Richard Henderson <rth@cygnus.com>
> On Tue, Sep 01, 1998 at 02:24:23PM +1000, Geoff Keating wrote:
> > The actual compare_and_swap procedure has two
> > 'sync' instructions surrounding the main code, which are 'asm
> > volatile' and therefore memory barriers.
>
> Um, asm_volatile is not a memory barrier. An asm with an
> explict memory clobber is.
When I said `memory barrier', I meant that gcc will not shift
loads/stores across the barrier. I think 'asm volatile' guarantees
this---I certainly hope it does.
They should have just explicit memory clobbers anyway, and no
'volatile'. I think the patch I presented earlier fixes this.
--
Geoffrey Keating <geoffk@ozemail.com.au>
More information about the Libc-hacker
mailing list