This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR c/68966] Restore atomic builtins usage in libstdc++-v3
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Marek Polacek <polacek at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jeff Law <law at redhat dot com>
- Date: Tue, 5 Apr 2016 20:04:19 +0100
- Subject: Re: [PR c/68966] Restore atomic builtins usage in libstdc++-v3
- Authentication-results: sourceware.org; auth=none
- References: <567A271B dot 2090403 at gmail dot com> <87zitsqbho dot fsf at kepler dot schwinge dot homeip dot net> <20160321150149 dot GK3805 at redhat dot com> <87zitrbz0o dot fsf at hertz dot schwinge dot homeip dot net> <20160405110148 dot GE5814 at redhat dot com> <20160405180835 dot GJ5814 at redhat dot com>
On 05/04/16 19:08 +0100, Jonathan Wakely wrote:
On 05/04/16 12:01 +0100, Jonathan Wakely wrote:
Well I guess it's mine, and this is a fairly serious regression (is it
tracked in Bugzilla anywhere?) so the patch is OK for trunk.
This is now https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70554
I've committed this smaller change, which still tests atomics for
bool, but simply removes the uses of __atomic_fetch_add for bool.
During stage 1 we can revisit whether we want to do something more
invasive and stop testing for atomics that we don't actually need.
Tested ppc64le-linux, x86_64-linux, comitted to trunk.
commit 7591475c21a34bbcce6d225ea7640d35022fb8ff
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Apr 5 19:16:05 2016 +0100
Restore atomic builtins usage in libstdc++-v3
PR libstdc++/70554
* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Don't test
__atomic_fetch_add for bool.
* configure: Regenerate.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 95df24a..b0f88cb 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3290,7 +3290,7 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
atomic_type c1;
atomic_type c2;
atomic_type c3(0);
- __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ // N.B. __atomic_fetch_add is not supported for bool.
__atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
__ATOMIC_RELAXED);
__atomic_test_and_set(&c1, __ATOMIC_RELAXED);
@@ -3375,7 +3375,7 @@ int main()
atomic_type c1;
atomic_type c2;
atomic_type c3(0);
- __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ // N.B. __atomic_fetch_add is not supported for bool.
__atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
__ATOMIC_RELAXED);
__atomic_test_and_set(&c1, __ATOMIC_RELAXED);