[PATCH] fix parisc atomic locking builtins for libgomp

John David Anglin dave@hiauly1.hia.nrc.ca
Mon Nov 24 21:47:00 GMT 2008


> On Mon, Nov 24, 2008 at 12:09 PM, John David Anglin
> <dave@hiauly1.hia.nrc.ca> wrote:
> >> This patch implies a bug in the kernel code.
> >>
> >> Under what condition is lws_errno == 0 and lws_ret != oldval?
> >
> > The issue is this code:
> >
> >        /* The load and store could fail */
> > 1:      ldw     0(%sr3,%r26), %r28
> >        sub,<>  %r28, %r25, %r0
> > 2:      stw     %r24, 0(%sr3,%r26)
> >
> > The return value is not changed if the store at 2 is not done.
> > However, I don't think the interface can be changed now.
> 
> When is the store at 2 not completed?

The store is not executed when r28 != r25 (the instruction after
the sub is nullified) by the completer "<>".  So, the exchange doesn't
occur when the old value passed by the caller doesn't equal the 
old value in the memory relocation.

It might have been better to return an error code when the exchange
doesn't occur.  This would have avoided the extra check.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)



More information about the Gcc-patches mailing list