This is the mail archive of the
mailing list for the GCC project.
Re: Patch for PR libgomp/37938, IA64 specific.
On Thu, Nov 6, 2008 at 10:33 AM, Steve Ellcey <firstname.lastname@example.org> wrote:
> On Thu, 2008-11-06 at 09:56 -0800, H.J. Lu wrote:
>> Shouldn't we use __sync_lock_test_and_set to initialize mutux?
>> --- libgomp/config/linux/mutex.h.sync 2006-11-18 06:22:18.000000000 -0800
>> +++ libgomp/config/linux/mutex.h 2008-11-06 09:50:46.000000000 -0800
>> @@ -38,7 +38,7 @@ typedef int gomp_mutex_t;
>> static inline void gomp_mutex_init (gomp_mutex_t *mutex)
>> - *mutex = 0;
>> + __sync_lock_test_and_set (mutex, 0);
>> extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex);
> I was wondering about the initialization but this patch didn't seem to
> fix the test case in PR 37938 when I added it and then removed my
We have to make sure that both read and write to mutex are done with
proper memory ordering. I don't think this is IA64 specific.
We can add a memory barrier before _sync_lock_test_and_set (). But I
don't think we should add a memory barrier in _sync_lock_test_and_set.