diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index dc86f86bdac5e9af8a95c162732a12424ef3d594..8cd5519f404dcdcab6920be2770e2d6ed71ff8b5 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -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
diff --git a/libgomp/critical.c b/libgomp/critical.c
index 70159ec7a6ed0691ec523815d397619884acfc71..90821634b5e98e78a4790513015c135e538c023f 100644
--- a/libgomp/critical.c
+++ b/libgomp/critical.c
@@ -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;