* critical.c (GOMP_critical_name_start): Fix *pptr initialization
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jun 2006 08:59:44 +0000 (08:59 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jun 2006 08:59:44 +0000 (08:59 +0000)
when gomp_mutex_t is larger than pointer and HAVE_SYNC_BUILTINS is
defined.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114843 138bc75d-0d04-0410-961f-82ee72b054a4

libgomp/ChangeLog
libgomp/critical.c

index dc86f86..8cd5519 100644 (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
index 70159ec..9082163 100644 (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;