critical.c (GOMP_critical_name_start): Fix *pptr initialization when gomp_mutex_t is larger than pointer and...

* critical.c (GOMP_critical_name_start): Fix *pptr initialization
	when gomp_mutex_t is larger than pointer and HAVE_SYNC_BUILTINS is
	defined.

From-SVN: r114843
This commit is contained in:
Jakub Jelinek 2006-06-21 10:59:44 +02:00 committed by Jakub Jelinek
parent 0841534abd
commit 5d7b51995e
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2006-06-21 Jakub Jelinek <jakub@redhat.com>
* critical.c (GOMP_critical_name_start): Fix *pptr initialization
when gomp_mutex_t is larger than pointer and HAVE_SYNC_BUILTINS is
defined.
2006-06-20 Jakub Jelinek <jakub@redhat.com>
PR libgomp/26175

View File

@ -72,12 +72,14 @@ GOMP_critical_name_start (void **pptr)
gomp_mutex_t *nlock = gomp_malloc (sizeof (gomp_mutex_t));
gomp_mutex_init (nlock);
plock = __sync_val_compare_and_swap (pptr, plock, nlock);
if (plock != nlock)
plock = __sync_val_compare_and_swap (pptr, NULL, nlock);
if (plock != NULL)
{
gomp_mutex_destroy (nlock);
free (nlock);
}
else
plock = nlock;
#else
gomp_mutex_lock (&create_lock_lock);
plock = *pptr;