diff mbox series

libgo patch committed: Use strong form of atomic_compare_exchange_n

Message ID CAOyqgcUroimq=V7bB8hy9BKSisULtOo+aFT8e6qUXCfR1rbo8w@mail.gmail.com
State New
Headers show
Series libgo patch committed: Use strong form of atomic_compare_exchange_n | expand

Commit Message

Ian Lance Taylor Feb. 6, 2019, 8:46 p.m. UTC
In GCC PR 89199 Lynn Boger points out that I used the weak form of
atomic_compare_exchange_n.  The upstream library uses, in effect, the
strong form, and the rest of the library expects the strong form.
This patch fixes libgo accordingly.  Bootstrapped and ran Go testsuite
on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268584)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-74ffeddbe6fef446129af65581b3a9094715bc22
+d89db31db68d09aa13a6137122cc096c1d92597b
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/sync/atomic/atomic.c
===================================================================
--- libgo/go/sync/atomic/atomic.c	(revision 268458)
+++ libgo/go/sync/atomic/atomic.c	(working copy)
@@ -69,7 +69,7 @@  _Bool CompareAndSwapInt32 (int32_t *, in
 _Bool
 CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new)
 {
-  return __atomic_compare_exchange_n (val, &old, new, true, __ATOMIC_SEQ_CST,
+  return __atomic_compare_exchange_n (val, &old, new, false, __ATOMIC_SEQ_CST,
 				      __ATOMIC_RELAXED);
 }
 
@@ -82,7 +82,7 @@  CompareAndSwapInt64 (int64_t *val, int64
 {
   if (((uintptr_t) val & 7) != 0)
     val = NULL;
-  return __atomic_compare_exchange_n (val, &old, new, true, __ATOMIC_SEQ_CST,
+  return __atomic_compare_exchange_n (val, &old, new, false, __ATOMIC_SEQ_CST,
 				      __ATOMIC_RELAXED);
 }
 
@@ -93,7 +93,7 @@  _Bool CompareAndSwapUint32 (uint32_t *,
 _Bool
 CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new)
 {
-  return __atomic_compare_exchange_n (val, &old, new, true, __ATOMIC_SEQ_CST,
+  return __atomic_compare_exchange_n (val, &old, new, false, __ATOMIC_SEQ_CST,
 				      __ATOMIC_RELAXED);
 }
 
@@ -106,7 +106,7 @@  CompareAndSwapUint64 (uint64_t *val, uin
 {
   if (((uintptr_t) val & 7) != 0)
     val = NULL;
-  return __atomic_compare_exchange_n (val, &old, new, true, __ATOMIC_SEQ_CST,
+  return __atomic_compare_exchange_n (val, &old, new, false, __ATOMIC_SEQ_CST,
 				      __ATOMIC_RELAXED);
 }
 
@@ -117,7 +117,7 @@  _Bool CompareAndSwapUintptr (uintptr_t *
 _Bool
 CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new)
 {
-  return __atomic_compare_exchange_n (val, &old, new, true, __ATOMIC_SEQ_CST,
+  return __atomic_compare_exchange_n (val, &old, new, false, __ATOMIC_SEQ_CST,
 				      __ATOMIC_RELAXED);
 }