public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled
@ 2022-05-25 17:32 lancethepants at gmail dot com
  2022-05-26  9:18 ` [Bug libstdc++/105730] " marxin at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: lancethepants at gmail dot com @ 2022-05-25 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105730
           Summary: Issue with commit - Allow std::condition_variable
                    waits to be cancelled
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lancethepants at gmail dot com
  Target Milestone: ---

I noticed that the lld-14 linker (and also lldb) built with gcc-12 was
segfaulting and pointing to libstdc++ in the backtrace.  I've narrowed it down
to commit 9e18a25331fa25c3907249fede65a02c6817b06e.  When I reverse this commit
then lld built by gcc functions again normally.

gcc-12.1 release
uclibc-ng c-standard library
armv7  cpu

I'm not sure if the issue is unique to uclibc-ng, arm, or if it's a general
issue to all platforms.


Here is the gdb log.

Starting program: /mmc/bin/ld.lld -plugin
/mmc/libexec/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/liblto_plugin.so
-plugin-opt=/mmc/libexec/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/lto-wrapper
-plugin-opt=-fresolution=/mmc/tmp/cc1ZwXDr.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--sysroot=/mmc --eh-frame-hdr -dynamic-linker /mmc/lib/ld-uClibc.so.1 -X -m
armelf_linux_eabi -o hello /mmc/usr/lib/crt1.o /mmc/usr/lib/crti.o
/mmc/lib/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/crtbegin.o
-L/mmc/lib/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0
-L/mmc/lib/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/../../../../arm-tomatoware-linux-uclibcgnueabi/lib
-L/mmc/lib/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/../../.. -L/mmc/lib
-L/mmc/usr/lib hello.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc
-lgcc --push-state --as-needed -lgcc_s --pop-state
/mmc/lib/gcc/arm-tomatoware-linux-uclibcgnueabi/12.1.0/crtend.o
/mmc/usr/lib/crtn.o
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/ld-uClibc.so.1]
Can't read data for section '.debug_info' in file '/mmc/lib/libLLVM-14.so'
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/usr/lib/libstdc++.so.6]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/libgcc_s.so.1]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/libc.so.0]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/libffi.so.8]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/libedit.so.0]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/libxml2.so.2]
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or
4) [in module /mmc/lib/liblzma.so.5]
[New LWP 27688]
[New LWP 27689]

Thread 2 "ld.lld" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 27688]
0x42deada0 in
std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.11 ()
from /mmc/usr/lib/libstdc++.so.6

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

* [Bug libstdc++/105730] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
@ 2022-05-26  9:18 ` marxin at gcc dot gnu.org
  2022-05-26  9:18 ` marxin at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-26  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
g:9e18a25331fa25c3907249fede65a02c6817b06e

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

* [Bug libstdc++/105730] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
  2022-05-26  9:18 ` [Bug libstdc++/105730] " marxin at gcc dot gnu.org
@ 2022-05-26  9:18 ` marxin at gcc dot gnu.org
  2022-10-25  7:17 ` [Bug libstdc++/105730] [12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-26  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-26

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
  2022-05-26  9:18 ` [Bug libstdc++/105730] " marxin at gcc dot gnu.org
  2022-05-26  9:18 ` marxin at gcc dot gnu.org
@ 2022-10-25  7:17 ` pinskia at gcc dot gnu.org
  2022-10-25 11:57 ` redi at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-25  7:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Issue with commit - Allow   |[12/13 Regression] Issue
                   |std::condition_variable     |with commit - Allow
                   |waits to be cancelled       |std::condition_variable
                   |                            |waits to be cancelled
   Target Milestone|---                         |12.3

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (2 preceding siblings ...)
  2022-10-25  7:17 ` [Bug libstdc++/105730] [12/13 Regression] " pinskia at gcc dot gnu.org
@ 2022-10-25 11:57 ` redi at gcc dot gnu.org
  2022-10-25 12:01 ` redi at gcc dot gnu.org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-25 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We're missing a proper testcase.

Is the buggy lld binary linked by lld, or binutils? Maybe there's a bug in
handling of ELF symbol versioning.

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (3 preceding siblings ...)
  2022-10-25 11:57 ` redi at gcc dot gnu.org
@ 2022-10-25 12:01 ` redi at gcc dot gnu.org
  2022-12-20 13:48 ` rguenth at gcc dot gnu.org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-25 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Lance Fredrickson from comment #0)
> Thread 2 "ld.lld" received signal SIGSEGV, Segmentation fault.
> [Switching to LWP 27688]
> 0x42deada0 in
> std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.11
> () from /mmc/usr/lib/libstdc++.so.6

If ld.lld was built against gcc-12 then why is it linking to the
@GLIBCXX_3.4.11 symbol?

Does this target support symbol renaming using .symver ?

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (4 preceding siblings ...)
  2022-10-25 12:01 ` redi at gcc dot gnu.org
@ 2022-12-20 13:48 ` rguenth at gcc dot gnu.org
  2022-12-20 15:50 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-20 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (5 preceding siblings ...)
  2022-12-20 13:48 ` rguenth at gcc dot gnu.org
@ 2022-12-20 15:50 ` pinskia at gcc dot gnu.org
  2022-12-21 11:52 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-20 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glex.spb at gmail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 108188 has been marked as a duplicate of this bug. ***

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (6 preceding siblings ...)
  2022-12-20 15:50 ` pinskia at gcc dot gnu.org
@ 2022-12-21 11:52 ` redi at gcc dot gnu.org
  2022-12-21 12:10 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-21 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bug 108188 has a reproducer

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (7 preceding siblings ...)
  2022-12-21 11:52 ` redi at gcc dot gnu.org
@ 2022-12-21 12:10 ` redi at gcc dot gnu.org
  2022-12-21 12:24 ` glex.spb at gmail dot com
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-21 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It seems like a problem with symbol resolution either during linking, or when
loading the dynamic library.

The old
_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@GLIBCXX_3.4.11 symbol
is an alias for __gnu_cxx::__nothrow_wait_cv::wait which calls the new
std::condition_variable::wait(unique_lock<mutex>&)@@GLIBCXX_3.4.30 symbol. But
here it's calling itself recursively, leading to a stack overflow segfault.

The call from __gnu_cxx::__nothrow_wait_cv::wait *should* bind to the new
symbol with version @@GLIBCXX_3.4.30 instead of the old one which is an alias
to itself.

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (8 preceding siblings ...)
  2022-12-21 12:10 ` redi at gcc dot gnu.org
@ 2022-12-21 12:24 ` glex.spb at gmail dot com
  2022-12-21 13:22 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: glex.spb at gmail dot com @ 2022-12-21 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Gleb Mazovetskiy <glex.spb at gmail dot com> ---
$ output/gcw0/host/bin/mipsel-gcw0-linux-uclibc-gcc-nm -gD
output/gcw0/target/lib/libstdc++.so | grep condition_variable | grep wait
00084ecc T
_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@GLIBCXX_3.4.11
000b2804 T
_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@@GLIBCXX_3.4.30

Note that the 3.4.11 has a single @.
All the other symbols have @@.

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (9 preceding siblings ...)
  2022-12-21 12:24 ` glex.spb at gmail dot com
@ 2022-12-21 13:22 ` redi at gcc dot gnu.org
  2022-12-21 13:22 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-21 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this should solve the problem:

--- a/libstdc++-v3/src/c++11/compatibility-condvar.cc
+++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc
@@ -67,6 +67,22 @@ _GLIBCXX_END_NAMESPACE_VERSION
     && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
+namespace
+{
+  std::__condvar std::condition_variable::* __base_member;
+
+  template<std::__condvar std::condition_variable::*X>
+    struct cracker
+    {
+      static std::__condvar std::condition_variable::* value;
+    };
+  template<std::__condvar std::condition_variable::*X>
+    std::__condvar std::condition_variable::*
+      cracker<X>::value = __base_member = X;
+
+  template class cracker<&std::condition_variable::_M_cond>;
+}
+
 struct __nothrow_wait_cv : std::condition_variable
 {
   void wait(std::unique_lock<std::mutex>&) noexcept;
@@ -76,7 +92,7 @@ __attribute__((used))
 void
 __nothrow_wait_cv::wait(std::unique_lock<std::mutex>& lock) noexcept
 {
-  this->condition_variable::wait(lock);
+  (this->*__base_member).wait(*lock.mutex());
 }
 } // namespace __gnu_cxx

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (10 preceding siblings ...)
  2022-12-21 13:22 ` redi at gcc dot gnu.org
@ 2022-12-21 13:22 ` redi at gcc dot gnu.org
  2022-12-21 13:45 ` glex.spb at gmail dot com
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-21 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Gleb Mazovetskiy from comment #7)
> Note that the 3.4.11 has a single @.
> All the other symbols have @@.

This is expected and entirely correct.

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (11 preceding siblings ...)
  2022-12-21 13:22 ` redi at gcc dot gnu.org
@ 2022-12-21 13:45 ` glex.spb at gmail dot com
  2022-12-22 23:35 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: glex.spb at gmail dot com @ 2022-12-21 13:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Gleb Mazovetskiy <glex.spb at gmail dot com> ---
The patch in Comment 8 fixes the issue for me!

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

* [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (12 preceding siblings ...)
  2022-12-21 13:45 ` glex.spb at gmail dot com
@ 2022-12-22 23:35 ` cvs-commit at gcc dot gnu.org
  2023-01-17 18:25 ` [Bug libstdc++/105730] [12 " lancethepants at gmail dot com
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-22 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r13-4857-gee4af2ed0b7322884ec4ff537564683c3749b813
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Dec 22 09:56:47 2022 +0000

    libstdc++: Avoid recursion in __nothrow_wait_cv::wait [PR105730]

    The commit r12-5877-g9e18a25331fa25 removed the incorrect
    noexcept-specifier from std::condition_variable::wait and gave the new
    symbol version @@GLIBCXX_3.4.30. It also redefined the original symbol
    std::condition_variable::wait(unique_lock<mutex>&)@GLIBCXX_3.4.11 as an
    alias for a new symbol, __gnu_cxx::__nothrow_wait_cv::wait, which still
    has the incorrect noexcept guarantee. That __nothrow_wait_cv::wait is
    just a wrapper around the real condition_variable::wait which adds
    noexcept and so terminates on a __forced_unwind exception.

    This doesn't work on uclibc, possibly due to a dynamic linker bug. When
    __nothrow_wait_cv::wait calls the condition_variable::wait function it
    binds to the alias symbol, which means it just calls itself recursively
    until the stack overflows.

    This change avoids the possibility of a recursive call by changing the
    __nothrow_wait_cv::wait function so that instead of calling
    condition_variable::wait it re-implements it. This requires accessing
    the private _M_cond member of condition_variable, so we need to use the
    trick of instantiating a template with the member-pointer of the private
    member.

    libstdc++-v3/ChangeLog:

            PR libstdc++/105730
            * src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
            Access private data member of base class and call its wait
            member.

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

* [Bug libstdc++/105730] [12 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (13 preceding siblings ...)
  2022-12-22 23:35 ` cvs-commit at gcc dot gnu.org
@ 2023-01-17 18:25 ` lancethepants at gmail dot com
  2023-01-17 19:01 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: lancethepants at gmail dot com @ 2023-01-17 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Lance Fredrickson <lancethepants at gmail dot com> changed:

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

--- Comment #12 from Lance Fredrickson <lancethepants at gmail dot com> ---
Marking as resolved as others have verified the patch works for uclibc-ng.

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

* [Bug libstdc++/105730] [12 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (14 preceding siblings ...)
  2023-01-17 18:25 ` [Bug libstdc++/105730] [12 " lancethepants at gmail dot com
@ 2023-01-17 19:01 ` redi at gcc dot gnu.org
  2023-01-17 19:23 ` glex.spb at gmail dot com
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-17 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please don't close it, the patch needs to be backported to the gcc-12 branch.

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

* [Bug libstdc++/105730] [12 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (15 preceding siblings ...)
  2023-01-17 19:01 ` redi at gcc dot gnu.org
@ 2023-01-17 19:23 ` glex.spb at gmail dot com
  2023-01-18 15:14 ` cvs-commit at gcc dot gnu.org
  2023-01-18 15:15 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: glex.spb at gmail dot com @ 2023-01-17 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Gleb Mazovetskiy <glex.spb at gmail dot com> ---
The patch applies cleanly to the latest gcc-12 release and also fixes the issue
there btw.

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

* [Bug libstdc++/105730] [12 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (16 preceding siblings ...)
  2023-01-17 19:23 ` glex.spb at gmail dot com
@ 2023-01-18 15:14 ` cvs-commit at gcc dot gnu.org
  2023-01-18 15:15 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-18 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:937b0f05910bd814459ba9af0972041514274cd7

commit r12-9051-g937b0f05910bd814459ba9af0972041514274cd7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Dec 22 09:56:47 2022 +0000

    libstdc++: Avoid recursion in __nothrow_wait_cv::wait [PR105730]

    The commit r12-5877-g9e18a25331fa25 removed the incorrect
    noexcept-specifier from std::condition_variable::wait and gave the new
    symbol version @@GLIBCXX_3.4.30. It also redefined the original symbol
    std::condition_variable::wait(unique_lock<mutex>&)@GLIBCXX_3.4.11 as an
    alias for a new symbol, __gnu_cxx::__nothrow_wait_cv::wait, which still
    has the incorrect noexcept guarantee. That __nothrow_wait_cv::wait is
    just a wrapper around the real condition_variable::wait which adds
    noexcept and so terminates on a __forced_unwind exception.

    This doesn't work on uclibc, possibly due to a dynamic linker bug. When
    __nothrow_wait_cv::wait calls the condition_variable::wait function it
    binds to the alias symbol, which means it just calls itself recursively
    until the stack overflows.

    This change avoids the possibility of a recursive call by changing the
    __nothrow_wait_cv::wait function so that instead of calling
    condition_variable::wait it re-implements it. This requires accessing
    the private _M_cond member of condition_variable, so we need to use the
    trick of instantiating a template with the member-pointer of the private
    member.

    libstdc++-v3/ChangeLog:

            PR libstdc++/105730
            * src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
            Access private data member of base class and call its wait
            member.

    (cherry picked from commit ee4af2ed0b7322884ec4ff537564683c3749b813)

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

* [Bug libstdc++/105730] [12 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled
  2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
                   ` (17 preceding siblings ...)
  2023-01-18 15:14 ` cvs-commit at gcc dot gnu.org
@ 2023-01-18 15:15 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-18 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
OK this can be closed now. Fixed for 12.3

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

end of thread, other threads:[~2023-01-18 15:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 17:32 [Bug libstdc++/105730] New: Issue with commit - Allow std::condition_variable waits to be cancelled lancethepants at gmail dot com
2022-05-26  9:18 ` [Bug libstdc++/105730] " marxin at gcc dot gnu.org
2022-05-26  9:18 ` marxin at gcc dot gnu.org
2022-10-25  7:17 ` [Bug libstdc++/105730] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-10-25 11:57 ` redi at gcc dot gnu.org
2022-10-25 12:01 ` redi at gcc dot gnu.org
2022-12-20 13:48 ` rguenth at gcc dot gnu.org
2022-12-20 15:50 ` pinskia at gcc dot gnu.org
2022-12-21 11:52 ` redi at gcc dot gnu.org
2022-12-21 12:10 ` redi at gcc dot gnu.org
2022-12-21 12:24 ` glex.spb at gmail dot com
2022-12-21 13:22 ` redi at gcc dot gnu.org
2022-12-21 13:22 ` redi at gcc dot gnu.org
2022-12-21 13:45 ` glex.spb at gmail dot com
2022-12-22 23:35 ` cvs-commit at gcc dot gnu.org
2023-01-17 18:25 ` [Bug libstdc++/105730] [12 " lancethepants at gmail dot com
2023-01-17 19:01 ` redi at gcc dot gnu.org
2023-01-17 19:23 ` glex.spb at gmail dot com
2023-01-18 15:14 ` cvs-commit at gcc dot gnu.org
2023-01-18 15:15 ` redi 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).