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 for PR libgomp/37938, IA64 specific.


On Thu, Nov 6, 2008 at 12:32 PM, Steve Ellcey <sje@cup.hp.com> wrote:
>
> On Thu, 2008-11-06 at 11:09 -0800, H.J. Lu wrote:
>
>> There are
>>
>> libgomp/critical.c:static gomp_mutex_t default_lock;
>> libgomp/critical.c:static gomp_mutex_t create_lock_lock;
>> libgomp/critical.c:  gomp_mutex_t *plock;
>> libgomp/critical.c:      && sizeof (gomp_mutex_t) <= sizeof (void *)
>> libgomp/critical.c:      && __alignof (gomp_mutex_t) <= sizeof (void *))
>> libgomp/critical.c:    plock = (gomp_mutex_t *)pptr;
>> libgomp/critical.c:     gomp_mutex_t *nlock = gomp_malloc (sizeof (gomp_mutex_t));
>> libgomp/critical.c:         plock = gomp_malloc (sizeof (gomp_mutex_t));
>> libgomp/critical.c:  gomp_mutex_t *plock;
>> libgomp/critical.c:      && sizeof (gomp_mutex_t) <= sizeof (void *)
>> libgomp/critical.c:      && __alignof (gomp_mutex_t) <= sizeof (void *))
>> libgomp/critical.c:    plock = (gomp_mutex_t *)pptr;
>> libgomp/critical.c:static gomp_mutex_t atomic_lock;
>>
>> Those reads look suspicious.
>
> I am not sure what reads you mean.  Do you mean the 'plock =
> (gomp_mutex_t *) pptr' statements? The sizeof and __alignof uses are not
> reads, right?  But pptr is a pointer to mutex and not a mutex itself, so
> reading pptr shouldn't be a problem.
>

You are right. I think we need to double check all codes in

#ifdef HAVE_SYNC_BUILTINS
...
#endif

to make sure that they have proper memory ordering.

-- 
H.J.


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