public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait
@ 2021-06-04 23:04 Thomas Rodgers
  2021-06-04 23:18 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-04 23:04 UTC (permalink / raw)
  To: gcc-patches, libstdc++; +Cc: trodgers, Thomas Rodgers

Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
	Change parameter type from _Tp to _Tp*.
	* testsuite/29_atomics/atomic_ref/deduction.cc: Add
	reproducer case from PR.
---
 libstdc++-v3/include/bits/atomic_base.h                   | 2 +-
 libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 029b8ad65a9..20cf1343c58 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_lib_atomic_wait
       _GLIBCXX_ALWAYS_INLINE void
-      wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
+      wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const noexcept
       { __atomic_impl::wait(_M_ptr, __old, __m); }
 
       // TODO add const volatile overload
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
index 86395b0c2b0..ed46b430f7c 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
@@ -34,6 +34,7 @@ test01()
   int* p = &i;
   std::atomic_ref a2(p);
   static_assert(std::is_same_v<decltype(a2), std::atomic_ref<int*>>);
+  a2.store(nullptr);
 
   struct X { } x;
   std::atomic_ref a3(x);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait
  2021-06-04 23:04 [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait Thomas Rodgers
@ 2021-06-04 23:18 ` Jonathan Wakely
  2021-06-05  0:44   ` [PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
  2021-06-07 22:02   ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889] Thomas Rodgers
  0 siblings, 2 replies; 10+ messages in thread
From: Jonathan Wakely @ 2021-06-04 23:18 UTC (permalink / raw)
  To: Thomas Rodgers; +Cc: gcc-patches, libstdc++, Thomas Rodgers

On Sat, 5 Jun 2021, 00:05 Thomas Rodgers, <rodgert@appliantology.com> wrote:

> Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
>         Change parameter type from _Tp to _Tp*.
>         * testsuite/29_atomics/atomic_ref/deduction.cc: Add
>         reproducer case from PR.
>

That file is testing CTAD, there should be a better place to add this.



---
>  libstdc++-v3/include/bits/atomic_base.h                   | 2 +-
>  libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/bits/atomic_base.h
> b/libstdc++-v3/include/bits/atomic_base.h
> index 029b8ad65a9..20cf1343c58 100644
> --- a/libstdc++-v3/include/bits/atomic_base.h
> +++ b/libstdc++-v3/include/bits/atomic_base.h
> @@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
>  #if __cpp_lib_atomic_wait
>        _GLIBCXX_ALWAYS_INLINE void
> -      wait(_Tp __old, memory_order __m = memory_order_seq_cst) const
> noexcept
> +      wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const
> noexcept
>        { __atomic_impl::wait(_M_ptr, __old, __m); }
>
>        // TODO add const volatile overload
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
> b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
> index 86395b0c2b0..ed46b430f7c 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc
> @@ -34,6 +34,7 @@ test01()
>    int* p = &i;
>    std::atomic_ref a2(p);
>    static_assert(std::is_same_v<decltype(a2), std::atomic_ref<int*>>);
> +  a2.store(nullptr);
>
>    struct X { } x;
>    std::atomic_ref a3(x);
> --
> 2.26.2
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-04 23:18 ` Jonathan Wakely
@ 2021-06-05  0:44   ` Thomas Rodgers
  2021-06-07 22:02   ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889] Thomas Rodgers
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-05  0:44 UTC (permalink / raw)
  To: gcc-patches, libstdc++; +Cc: trodgers, Thomas Rodgers

Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
	Change parameter type from _Tp to _Tp*.
	* testsuite/29_atomics/atomic_ref/100889.cc: New test.
---
 libstdc++-v3/include/bits/atomic_base.h       |  2 +-
 .../testsuite/29_atomics/atomic_ref/100889.cc | 29 +++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_ref/100889.cc

diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 029b8ad65a9..20cf1343c58 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_lib_atomic_wait
       _GLIBCXX_ALWAYS_INLINE void
-      wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
+      wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const noexcept
       { __atomic_impl::wait(_M_ptr, __old, __m); }
 
       // TODO add const volatile overload
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/100889.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/100889.cc
new file mode 100644
index 00000000000..1ea58cb6947
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/100889.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2019-2021 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <atomic>
+
+void
+test01()
+{
+  void* p;
+  std::atomic_ref a(p);
+  a.store(nullptr);
+}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889]
  2021-06-04 23:18 ` Jonathan Wakely
  2021-06-05  0:44   ` [PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
@ 2021-06-07 22:02   ` Thomas Rodgers
  2021-06-08  0:28     ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-07 22:02 UTC (permalink / raw)
  To: gcc-patches, libstdc++; +Cc: trodgers, Thomas Rodgers

Fixes libstdc++/100889

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
	Change parameter type from _Tp to _Tp*.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
	coverage of types tested.
---
 libstdc++-v3/include/bits/atomic_base.h       |  2 +-
 .../29_atomics/atomic_ref/wait_notify.cc      | 38 ++++++++++++-------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 029b8ad65a9..20cf1343c58 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_lib_atomic_wait
       _GLIBCXX_ALWAYS_INLINE void
-      wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
+      wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const noexcept
       { __atomic_impl::wait(_M_ptr, __old, __m); }
 
       // TODO add const volatile overload
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
index 2fd31304222..2500dddf884 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
@@ -26,22 +26,34 @@
 
 #include <testsuite_hooks.h>
 
+template<typename S>
+  void
+  test (S va, S vb)
+  {
+    S aa{ va };
+    S bb{ vb };
+    std::atomic_ref<S> a{ aa };
+    a.wait(bb);
+    std::thread t([&]
+      {
+        a.store(bb);
+        a.notify_one();
+      });
+    a.wait(aa);
+    t.join();
+  }
+
 int
 main ()
 {
+  test<int>(0, 42);
+  test<long>(0, 42);
+  test<unsigned>(0u, 42u);
+  test<float>(0.0f, 42.0f);
+  test<double>(0.0, 42.0);
+  test<void*>(nullptr, reinterpret_cast<void*>(42));
+
   struct S{ int i; };
-  S aa{ 0 };
-  S bb{ 42 };
-
-  std::atomic_ref<S> a{ aa };
-  VERIFY( a.load().i == aa.i );
-  a.wait(bb);
-  std::thread t([&]
-    {
-      a.store(bb);
-      a.notify_one();
-    });
-  a.wait(aa);
-  t.join();
+  test<S>(S{ 0 }, S{ 42 });
   return 0;
 }
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-07 22:02   ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889] Thomas Rodgers
@ 2021-06-08  0:28     ` Thomas Rodgers
  2021-06-08 15:44       ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-08  0:28 UTC (permalink / raw)
  To: gcc-patches, libstdc++; +Cc: trodgers, Thomas Rodgers

This time without the repeatred [PRnnnn] in the subject line.

Fixes libstdc++/100889

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
	Change parameter type from _Tp to _Tp*.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
	coverage of types tested.
---
 libstdc++-v3/include/bits/atomic_base.h       |  2 +-
 .../29_atomics/atomic_ref/wait_notify.cc      | 38 ++++++++++++-------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 029b8ad65a9..20cf1343c58 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_lib_atomic_wait
       _GLIBCXX_ALWAYS_INLINE void
-      wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
+      wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const noexcept
       { __atomic_impl::wait(_M_ptr, __old, __m); }
 
       // TODO add const volatile overload
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
index 2fd31304222..2500dddf884 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
@@ -26,22 +26,34 @@
 
 #include <testsuite_hooks.h>
 
+template<typename S>
+  void
+  test (S va, S vb)
+  {
+    S aa{ va };
+    S bb{ vb };
+    std::atomic_ref<S> a{ aa };
+    a.wait(bb);
+    std::thread t([&]
+      {
+        a.store(bb);
+        a.notify_one();
+      });
+    a.wait(aa);
+    t.join();
+  }
+
 int
 main ()
 {
+  test<int>(0, 42);
+  test<long>(0, 42);
+  test<unsigned>(0u, 42u);
+  test<float>(0.0f, 42.0f);
+  test<double>(0.0, 42.0);
+  test<void*>(nullptr, reinterpret_cast<void*>(42));
+
   struct S{ int i; };
-  S aa{ 0 };
-  S bb{ 42 };
-
-  std::atomic_ref<S> a{ aa };
-  VERIFY( a.load().i == aa.i );
-  a.wait(bb);
-  std::thread t([&]
-    {
-      a.store(bb);
-      a.notify_one();
-    });
-  a.wait(aa);
-  t.join();
+  test<S>(S{ 0 }, S{ 42 });
   return 0;
 }
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-08  0:28     ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
@ 2021-06-08 15:44       ` Jonathan Wakely
  2021-06-08 23:03         ` Thomas Rodgers
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2021-06-08 15:44 UTC (permalink / raw)
  To: Thomas Rodgers; +Cc: gcc-patches, libstdc++, Thomas Rodgers

On Tue, 8 Jun 2021 at 01:29, Thomas Rodgers wrote:

> This time without the repeatred [PRnnnn] in the subject line.
>
> Fixes libstdc++/100889
>

This should be part of the ChangeLog entry instead, preceded by PR so it
updates bugzilla, i.e.



> libstdc++-v3/ChangeLog:
>

<TAB>PR libstdc++/100889


>         * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
>         Change parameter type from _Tp to _Tp*.
>         * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
>         coverage of types tested.
>


OK for trunk and gcc-11 with that change, thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-08 15:44       ` Jonathan Wakely
@ 2021-06-08 23:03         ` Thomas Rodgers
  2021-06-09 14:30           ` Christophe Lyon
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-08 23:03 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Thomas Rodgers, gcc-patches, libstdc++

Tested x86_64-pc-linux-gnu, committed to master, backported to
releases/gcc-11.

On Tue, Jun 8, 2021 at 8:44 AM Jonathan Wakely <jwakely@redhat.com> wrote:

> On Tue, 8 Jun 2021 at 01:29, Thomas Rodgers wrote:
>
>> This time without the repeatred [PRnnnn] in the subject line.
>>
>> Fixes libstdc++/100889
>>
>
> This should be part of the ChangeLog entry instead, preceded by PR so it
> updates bugzilla, i.e.
>
>
>
>> libstdc++-v3/ChangeLog:
>>
>
> <TAB>PR libstdc++/100889
>
>
>>         * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
>>         Change parameter type from _Tp to _Tp*.
>>         * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
>>         coverage of types tested.
>>
>
>
> OK for trunk and gcc-11 with that change, thanks.
>
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-08 23:03         ` Thomas Rodgers
@ 2021-06-09 14:30           ` Christophe Lyon
  2021-06-09 14:52             ` Thomas Rodgers
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2021-06-09 14:30 UTC (permalink / raw)
  To: Thomas Rodgers; +Cc: Jonathan Wakely, gcc Patches, libstdc++

Hi,


On Wed, 9 Jun 2021 at 01:05, Thomas Rodgers via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Tested x86_64-pc-linux-gnu, committed to master, backported to
> releases/gcc-11.
>
> On Tue, Jun 8, 2021 at 8:44 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> > On Tue, 8 Jun 2021 at 01:29, Thomas Rodgers wrote:
> >
> >> This time without the repeatred [PRnnnn] in the subject line.
> >>
> >> Fixes libstdc++/100889
> >>
> >
> > This should be part of the ChangeLog entry instead, preceded by PR so it
> > updates bugzilla, i.e.
> >
> >
> >
> >> libstdc++-v3/ChangeLog:
> >>
> >
> > <TAB>PR libstdc++/100889
> >
> >
> >>         * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
> >>         Change parameter type from _Tp to _Tp*.
> >>         * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
> >>         coverage of types tested.
> >>
> >
> >
> > OK for trunk and gcc-11 with that change, thanks.
> >
> >

This is causing a regression on old arm targets:
--target arm-none-linux-gnueabi
RUNTESTFLAGS: -march=armv5t

FAIL: 29_atomics/atomic_ref/wait_notify.cc (test for excess errors)
Excess errors:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
/ccaaHfBz.o: in function `void
std::__atomic_impl::store<double>(double*,
std::remove_volatile<double>::type, std::memory_order)':
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:971:
undefined reference to `__atomic_store_8'
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
/ccaaHfBz.o: in function `std::remove_volatile<double>::type
std::__atomic_impl::load<double>(double const*, std::memory_order)':
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
undefined reference to `__atomic_load_8'
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
undefined reference to `__atomic_load_8'
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
undefined reference to `__atomic_load_8'
collect2: error: ld returned 1 exit status

Can you check?

Thanks

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-09 14:30           ` Christophe Lyon
@ 2021-06-09 14:52             ` Thomas Rodgers
  2021-06-09 15:11               ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-09 14:52 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: Jonathan Wakely, gcc Patches, libstdc++

Pretty sure I know this is, I'll work on a fix today.

On Wed, Jun 9, 2021 at 7:30 AM Christophe Lyon <christophe.lyon@linaro.org>
wrote:

> Hi,
>
>
> On Wed, 9 Jun 2021 at 01:05, Thomas Rodgers via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > Tested x86_64-pc-linux-gnu, committed to master, backported to
> > releases/gcc-11.
> >
> > On Tue, Jun 8, 2021 at 8:44 AM Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >
> > > On Tue, 8 Jun 2021 at 01:29, Thomas Rodgers wrote:
> > >
> > >> This time without the repeatred [PRnnnn] in the subject line.
> > >>
> > >> Fixes libstdc++/100889
> > >>
> > >
> > > This should be part of the ChangeLog entry instead, preceded by PR so
> it
> > > updates bugzilla, i.e.
> > >
> > >
> > >
> > >> libstdc++-v3/ChangeLog:
> > >>
> > >
> > > <TAB>PR libstdc++/100889
> > >
> > >
> > >>         * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
> > >>         Change parameter type from _Tp to _Tp*.
> > >>         * testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
> > >>         coverage of types tested.
> > >>
> > >
> > >
> > > OK for trunk and gcc-11 with that change, thanks.
> > >
> > >
>
> This is causing a regression on old arm targets:
> --target arm-none-linux-gnueabi
> RUNTESTFLAGS: -march=armv5t
>
> FAIL: 29_atomics/atomic_ref/wait_notify.cc (test for excess errors)
> Excess errors:
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
> /ccaaHfBz.o: in function `void
> std::__atomic_impl::store<double>(double*,
> std::remove_volatile<double>::type, std::memory_order)':
>
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:971:
> undefined reference to `__atomic_store_8'
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
> /ccaaHfBz.o: in function `std::remove_volatile<double>::type
> std::__atomic_impl::load<double>(double const*, std::memory_order)':
>
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
> undefined reference to `__atomic_load_8'
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
>
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
> undefined reference to `__atomic_load_8'
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/ld:
>
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc3/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_base.h:979:
> undefined reference to `__atomic_load_8'
> collect2: error: ld returned 1 exit status
>
> Can you check?
>
> Thanks
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
  2021-06-09 14:52             ` Thomas Rodgers
@ 2021-06-09 15:11               ` Jonathan Wakely
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Wakely @ 2021-06-09 15:11 UTC (permalink / raw)
  To: Thomas Rodgers; +Cc: Christophe Lyon, gcc Patches, libstdc++

For other tests that don't link to libatomic we use if-constexpr to
limit which types we test e.g.

--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
@@ -33,14 +33,17 @@ template<typename S>
    S aa{ va };
    S bb{ vb };
    std::atomic_ref<S> a{ aa };
-    a.wait(bb);
-    std::thread t([&]
+    if constexpr (std::atomic_ref<S>::is_always_lock_free)
      {
-       a.store(bb);
-       a.notify_one();
-      });
-    a.wait(aa);
-    t.join();
+       a.wait(bb);
+       std::thread t([&]
+         {
+           a.store(bb);
+           a.notify_one();
+         });
+       a.wait(aa);
+       t.join();
+      }
  }

int


Alternatively we could add arm*-*-* to the targets in
add_options_for_libatomic in testsuite/lib/dg-options.exp


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-09 15:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 23:04 [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait Thomas Rodgers
2021-06-04 23:18 ` Jonathan Wakely
2021-06-05  0:44   ` [PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
2021-06-07 22:02   ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889] Thomas Rodgers
2021-06-08  0:28     ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
2021-06-08 15:44       ` Jonathan Wakely
2021-06-08 23:03         ` Thomas Rodgers
2021-06-09 14:30           ` Christophe Lyon
2021-06-09 14:52             ` Thomas Rodgers
2021-06-09 15:11               ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).