This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82635] std::thread's join broken on FreeBSD with all GCCs >= 5
- From: "h2+bugs at fsfe dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Oct 2017 14:59:17 +0000
- Subject: [Bug c++/82635] std::thread's join broken on FreeBSD with all GCCs >= 5
- Auto-submitted: auto-generated
- References: <bug-82635-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82635
--- Comment #4 from Hannes Hauswedell <h2+bugs at fsfe dot org> ---
> the complete command line that triggers the bug;
/usr/local/bin/g++7 -Wl,-rpath -Wl,/usr/local/lib/gcc7/ -std=c++11 -pthread
test_thread.cpp
(g++7 could be g++6 g++6 or g++8)
> Are you linking to libpthread?
I am calling -pthread (or -lpthread), but ldd says:
% ldd a.out
a.out:
libstdc++.so.6 => /usr/local/lib/gcc7//libstdc++.so.6 (0x800825000)
libm.so.5 => /lib/libm.so.5 (0x800bba000)
libgcc_s.so.1 => /usr/local/lib/gcc7//libgcc_s.so.1 (0x800de5000)
libthr.so.3 => /lib/libthr.so.3 (0x800ffc000)
libc.so.7 => /lib/libc.so.7 (0x801224000)
The broken combinations crash after a few iterations:
% ./a.out
Hallo
Waited successfully. Was joinable: 1
Hallo
Waited successfully. Was joinable: 1
Hallo
Waited successfully. Was joinable: 1
Hallo
Waited successfully. Was joinable: 1
Hallo
Waited successfully. Was joinable: 1
Hallo
[1] 2613 segmentation fault (core dumped) ./a.out
The crash happens when calling .joinable(). If we skip the joinable check it
crashes on .join().