[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2023-08-07 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

--- Comment #17 from Jonathan Wakely  ---
GCC 9 hasn't changed, so it must be something in your Ubuntu environment or
your code.

I don't think the RTLD_xxx approach was ever robust, the libpthread.so library
needs to be loaded before the first __gthread_active_p() check in the whole
executable. That can be achieved by linking the executable to libpthread or
preloading it. Or using a newer glibc where libpthread.so is empty and all the
pthreads functions live in libc.so anyway.

[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2023-08-07 Thread colin.davidson at codeplay dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

colin.davidson at codeplay dot com changed:

   What|Removed |Added

 CC||colin.davidson at codeplay dot 
com

--- Comment #16 from colin.davidson at codeplay dot com ---
I've started seeing this throw error in the last few days (both in dockers and
locally on ubuntu 20.04). This was in previously working code which used dlopen
on a library with pthreads. We used RTLD_LAZY | RTLD_GLOBAL to work around
previous crashes but now we can't get the code to work unless we LD_PRELOAD the
pthreads library first.

I'm on libstdc++.so.6.0.28,  gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2023-04-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Jonathan Wakely  ---
Fixed for 10.5 and up.

[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2023-04-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

--- Comment #14 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
:

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

commit r10-11325-ge2babb0540cfa66752214f3f111461e1da4b26ce
Author: Jonathan Wakely 
Date:   Tue Nov 24 12:48:31 2020 +

libstdc++: Throw instead of segfaulting in std::thread constructor [PR
67791]

This turns a mysterious segfault into an exception with a more useful
message. If the exception isn't caught, the user sees this instead of
just a segfault:

terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not
permitted
Aborted (core dumped)

libstdc++-v3/ChangeLog:

PR libstdc++/67791
* src/c++11/thread.cc (thread::_M_start_thread(_State_ptr, void
(*)())):
Check that gthreads is available before calling __gthread_create.

(cherry picked from commit 4bbd5d0c5fb2b7527938ad44a6d8a2f2ef8bbe12)

[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2022-06-28 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|10.4|10.5

--- Comment #13 from Jakub Jelinek  ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

[Bug libstdc++/67791] [10 Regression] Crash using std::thread and iostream with dynamic loading of a shared library

2022-05-27 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|9.5 |10.4

--- Comment #12 from Richard Biener  ---
GCC 9 branch is being closed