public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait
@ 2021-06-03  5:59 richardpku at gmail dot com
  2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: richardpku at gmail dot com @ 2021-06-03  5:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100889
           Summary: Wrong param type for std::atomic_ref<_Tp*>::wait
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richardpku at gmail dot com
  Target Milestone: ---

/tmp % cat a.cpp
#include <atomic>
void* p;
void foo() { std::atomic_ref(p).store(nullptr); }

/tmp % g++-11.1.0 -c -std=gnu++20 a.cpp
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/atomic:41,
                 from a.cpp:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h: In
instantiation of 'struct std::__atomic_ref<void*, false, false>':
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/atomic:1618:12:  
required from 'struct std::atomic_ref<void*>'
a.cpp:3:31:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h:1873:7:
error: invalid parameter type 'void'
 1873 |       wait(_Tp __old, memory_order __m = memory_order_seq_cst) const
noexcept
      |       ^~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h:1873:7:
error: in declaration 'void std::__atomic_ref<_Tp*, false, false>::wait(_Tp,
std::memory_order) const'


Apparently, the first param of std::atomic<_Tp*>::wait should be _Tp* instead
of _Tp.

It appears this bug has existed since GCC 11, when __cpp_lib_atomic_wait was
implemented.

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
@ 2021-06-03  6:02 ` richardpku at gmail dot com
  2021-06-03 10:20 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: richardpku at gmail dot com @ 2021-06-03  6:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Li <richardpku at gmail dot com> ---
Created attachment 50917
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50917&action=edit
Proposed patch

This patch fixes the problem.

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
  2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
@ 2021-06-03 10:20 ` redi at gcc dot gnu.org
  2021-06-04 15:44 ` rodgertq at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-03 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2021-06-03
                 CC|                            |rodgertq at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
  2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
  2021-06-03 10:20 ` redi at gcc dot gnu.org
@ 2021-06-04 15:44 ` rodgertq at gcc dot gnu.org
  2021-06-08 23:01 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rodgertq at gcc dot gnu.org @ 2021-06-04 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Rodgers <rodgertq at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
                   ` (2 preceding siblings ...)
  2021-06-04 15:44 ` rodgertq at gcc dot gnu.org
@ 2021-06-08 23:01 ` cvs-commit at gcc dot gnu.org
  2021-06-08 23:02 ` cvs-commit at gcc dot gnu.org
  2021-06-08 23:11 ` rodgertq at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-08 23:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Rodgers <rodgertq@gcc.gnu.org>:

https://gcc.gnu.org/g:25e5ecdf82b49977e86bfaded236fb34af2705ed

commit r12-1312-g25e5ecdf82b49977e86bfaded236fb34af2705ed
Author: Thomas Rodgers <rodgert@appliantology.com>
Date:   Tue Jun 8 15:51:53 2021 -0700

    libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

    libstdc++-v3/ChangeLog:

            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.

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
                   ` (3 preceding siblings ...)
  2021-06-08 23:01 ` cvs-commit at gcc dot gnu.org
@ 2021-06-08 23:02 ` cvs-commit at gcc dot gnu.org
  2021-06-08 23:11 ` rodgertq at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-08 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Thomas Rodgers
<rodgertq@gcc.gnu.org>:

https://gcc.gnu.org/g:d7462945387b33744f665d1aa33ba1cec79c03b0

commit r11-8528-gd7462945387b33744f665d1aa33ba1cec79c03b0
Author: Thomas Rodgers <rodgert@appliantology.com>
Date:   Tue Jun 8 15:51:53 2021 -0700

    libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

    libstdc++-v3/ChangeLog:

            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.

    (cherry picked from commit 25e5ecdf82b49977e86bfaded236fb34af2705ed)

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

* [Bug libstdc++/100889] Wrong param type for std::atomic_ref<_Tp*>::wait
  2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
                   ` (4 preceding siblings ...)
  2021-06-08 23:02 ` cvs-commit at gcc dot gnu.org
@ 2021-06-08 23:11 ` rodgertq at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rodgertq at gcc dot gnu.org @ 2021-06-08 23:11 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Rodgers <rodgertq at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Thomas Rodgers <rodgertq at gcc dot gnu.org> ---
Fixed in master, backported to releases/gcc-11

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

end of thread, other threads:[~2021-06-08 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
2021-06-03 10:20 ` redi at gcc dot gnu.org
2021-06-04 15:44 ` rodgertq at gcc dot gnu.org
2021-06-08 23:01 ` cvs-commit at gcc dot gnu.org
2021-06-08 23:02 ` cvs-commit at gcc dot gnu.org
2021-06-08 23:11 ` rodgertq at gcc dot gnu.org

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).