This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix parisc atomic locking builtins for libgomp


> 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]