[Bug libstdc++/104852] std::[j]thread::detach() still gives segmentation faults with glibc 2.34

2022-03-09 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104852

--- Comment #5 from Jackson Huff  ---
Just for reference, another person in bug 52590 had tried the same before but
also had no luck.

[Bug libstdc++/104852] std::[j]thread::detach() still gives segmentation faults with glibc 2.34

2022-03-09 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104852

--- Comment #4 from Jackson Huff  ---
(In reply to Jonathan Wakely from comment #2)
> For distros other than Red Hat (and Fedora, CentOS etc.) you need to use:
> 
> -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
> 
> Otherwise the pthread symbols do not get pulled in by the linker.

This would seem like a fix, but applying those flags to both the ADD_FLAGS
variable and both manually specifying then in CMakeLists.txt made no difference
(I tried variations for hours but no dice).

[Bug libstdc++/95989] Segmentation fault compiling with static libraries and using jthread::request_stop

2022-03-08 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95989

--- Comment #22 from Jackson Huff  ---
See bug 104852

[Bug libstdc++/104852] std::[j]thread::detach() still gives segmentation faults with glibc 2.34

2022-03-08 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104852

--- Comment #1 from Jackson Huff  ---
Note that my CMake command includes -lpthread even though CMake has been
configured to link it already with -pthread, so when reproducing it, remove
-lpthread to better replicate the situation (I only realized this after
posting).

[Bug libstdc++/104852] New: std::[j]thread::detach() still gives segmentation faults with glibc 2.34

2022-03-08 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104852

Bug ID: 104852
   Summary: std::[j]thread::detach() still gives segmentation
faults with glibc 2.34
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: lightningdzeyenr at gmail dot com
  Target Milestone: ---

I'm using g++ 11.2.0 on Ubuntu 21.10 (Pop!_OS 21.10) and trying to compile a
project that uses the std::[j]thread::detach() function a lot. When I
statically link it, I always get a segmentation fault for what seems to be
something in the libpthread library. This happens with both std::thread and
std::jthread. ldd --version shows a glibc version of 2.34 (specifically
2.34-0ubuntu3.2), and ld --version shows 2.37, both versions at which this bug
should have been fixed. Here's the output of g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu [I'm using AMD Zen 3]
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-7ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-ZPT0kp/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-ZPT0kp/gcc-11-11.2.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2)

I'm compiling with the CMake command 
> cmake source -DADD_FLAGS="-static -lpthread"
which adds these flags to the end of CMAKE_CXX_FLAGS, and
> cmake --build . -j 12
to build.

I can't provide the .i files because even compressed as a .tar.gz, the archive
is too big (4.5MB). However, this is reproducible by cloning the repo 
(https://github.com/Slackadays/Hajime), cd hajime, and issuing the two CMake
commands above.

Output of GDB:

Thread 2 "hajime" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x77ff8640 (LWP 52019)]
0x in ?? ()
(gdb) bt
#0  0x in ?? ()
#1  0x00510745 in std::thread::detach() ()
#2  0x0044ca76 in Server::startProgram (this=0x7022b0, method=...) at
/home/jackson/hajime/source/server.cpp:290
#3  0x0044ad15 in Server::startServer (this=0x7022b0, confFile=...) at
/home/jackson/hajime/source/server.cpp:112
#4  0x00449d8f in std::__invoke_impl,
std::allocator >), std::shared_ptr,
std::__cxx11::basic_string, std::allocator >
> (__f=
@0x6ff0c8: (void (Server::*)(Server * const,
std::__cxx11::basic_string, std::allocator
>)) 0x44a298 , std::allocator >)>, __t=...) at
/usr/include/c++/11/bits/invoke.h:74
#5  0x00449c45 in std::__invoke,
std::allocator >), std::shared_ptr,
std::__cxx11::basic_string, std::allocator >
> (__fn=
@0x6ff0c8: (void (Server::*)(Server * const,
std::__cxx11::basic_string, std::allocator
>)) 0x44a298 , std::allocator >)>) at
/usr/include/c++/11/bits/invoke.h:96
#6  0x00449b35 in std::thread::_Invoker,
std::allocator >), std::shared_ptr,
std::__cxx11::basic_string, std::allocator >
> >::_M_invoke<0ul, 1ul, 2ul> (this=0x6ff098)
at /usr/include/c++/11/bits/std_thread.h:253
#7  0x0044958a in std::thread::_Invoker,
std::allocator >), std::shared_ptr,
std::__cxx11::basic_string, std::allocator >
> >::operator() (this=0x6ff098)
at /usr/include/c++/11/bits/std_thread.h:260
#8  0x00449422 in
std::thread::_State_impl,
std::allocator >), std::shared_ptr,
std::__cxx11::basic_string, std::allocator >
> > >::_M_run (
this=0x6ff090) at /usr/include/c++/11/bits/std_thread.h:211
#9  0x005104b4 in execute_native_thread_routine ()
#10 0x0058a877 in start_thread ()
#11 0x0060d814 in clone ()
(gdb)

[Bug libstdc++/95989] Segmentation fault compiling with static libraries and using jthread::request_stop

2022-03-03 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95989

Jackson Huff  changed:

   What|Removed |Added

 CC||lightningdzeyenr at gmail dot 
com

--- Comment #20 from Jackson Huff  ---
Have there been any updates regarding segfaults with pthread_join? I'm also
getting a segfault but with the C++20 jthread::detach() function instead.

[Bug c++/103701] C++20 modules create internal compiler error at import_export_decl

2021-12-13 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103701

--- Comment #1 from Jackson Huff  ---
Created attachment 51996
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51996&action=edit
The preprocessed file that causes the compiler error

The original file upload failed because the preprocessed source is double the
maximum size, so this new one should work

[Bug c++/103701] New: C++20 modules create internal compiler error at import_export_decl

2021-12-13 Thread lightningdzeyenr at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103701

Bug ID: 103701
   Summary: C++20 modules create internal compiler error at
import_export_decl
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: lightningdzeyenr at gmail dot com
  Target Milestone: ---

When trying to compile a C++ file which uses modules from C++20, I get the
following output:

In module imported at hajime.cpp:24:9:
Hajime:Installer: note: unable to represent further imported source locations
hajime.cpp:182:1: internal compiler error: in import_export_decl, at
cp/decl2.c:3060
  182 | }
  | ^
0xe30681 internal_error(char const*, ...)
???:0
0xe27235 fancy_abort(char const*, int, char const*)
???:0
0xf9fe77 c_parse_final_cleanups()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

For the GCC version, I'm using 11.1.0 (Ubuntu 11.1.0-1ubuntu1~21.04) on a
x86_64 system. The compile command that produced the exact above output is
this:

g++-11 -std=c++20 -fmodules-ts hajime.cpp

For the rest of the GCC configuration, here it is:

Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.1.0-1ubuntu1~21.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-RPS7jb/gcc-11-11.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-RPS7jb/gcc-11-11.1.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd

Finally, I've included the .ii file that was made with -save-temps. Just in
case you want to see the original code that causes this error, this GitHub repo
has it all: https://github.com/Slackadays/Hajime/tree/modules/source