On 20/01/15 11:59 +0000, Jonathan Wakely wrote:
On 19/01/15 16:02 +0000, Jonathan Wakely wrote:
We declare atomic_init() but then never define it, I assume that's
just an accident.

Although the standard says this function is non-atomic, the simplest
fix at this stage is just to do an atomic store (when we get to stage
1 again I'd like to make the function a friend of std::__atomic_base<>
so it can set the private member variable directly as a simple
non-atomic assignment).

Tested x86_64-linux, *not* committed to trunk.

Now committed to trunk.

commit 061dd1a073ef4646727a3f29dfa3169a760757b3
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Sun Jan 18 17:40:17 2015 +0000

        PR libstdc++/64658
        * include/std/atomic (atomic_init): Define.
        * testsuite/29_atomics/atomic/64658.cc: New.

I forgot to make this testcase change that Ulrich suggested.

Tested x86_64-linux and i686-linux, committed to trunk.

commit b4d3e97d1890a1870f43e95aee493a5bb540e6f2
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Jan 21 14:28:37 2015 +0000

    	* testsuite/29_atomics/atomic/64658.cc: Test stored value.

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc b/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc
index 64739e0..0b2ff43 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc
@@ -17,13 +17,14 @@
 
 // { dg-require-atomic-builtins "" }
 // { dg-options "-std=gnu++11" }
-// { dg-do link }
 
 #include <atomic>
+#include <testsuite_hooks.h>
 
 int
 main()
 {
   std::atomic<int> i;
-  atomic_init(&i, 0);
+  atomic_init(&i, 5);
+  VERIFY( i == 5 );
 }

Reply via email to