Created attachment 349662 [details] Source file which demonstrates the problem Description of problem: Program crashes with SIGSEGV when constructing a std::thread. Version-Release number of selected component (if applicable): gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC) How reproducible: Always. Steps to Reproduce: 1. Compile the attached source file with g++ -std=c++0x 2. Run the program. 3. Actual results: Program crashes. Expected results: Program runs. Additional info: (gdb) bt full #0 _dl_fixup (l=<value optimized out>, reloc_arg=<value optimized out>) at dl-runtime.c:139 reloc = <value optimized out> sym = 0x0 result = 0x0 value = 0 __PRETTY_FUNCTION__ = "_dl_fixup" #1 0x005bf8b0 in _dl_runtime_resolve () at ../sysdeps/i386/dl-trampoline.S:37 No locals. #2 0x07d3a9f1 in __gthread_create (__args=<value optimized out>, __func=<value optimized out>, __threadid=<value optimized out>) at /usr/src/debug/gcc-4.4.0-20090506/obj-i586-redhat-linux/i586-redhat-linux/libstdc++-v3/include/i586-redhat-linux/bits/gthr-default.h:679 No locals. #3 std::thread::_M_start_thread (__args=<value optimized out>, __func=<value optimized out>, __threadid=<value optimized out>) at ../../../../libstdc++-v3/src/thread.cc:88 __e = <value optimized out> #4 0x08048a57 in std::thread::thread<Foo> (this=0xbffff348, __f={<No data fields>}) at /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../../include/c++/4.4.0/thread:129 No locals. #5 0x080488e4 in main (argc=1, argv=0xbffff404) at sandbox.cpp:25 f = {<No data fields>}
This bug seems to occur only when the -pthread argument to GCC is missing. This argument is, of course, required to compile programs using pthreads. I suppose that leaving the argument out yields "undefined behaviour".
Obviously if you use std::thread and don't link with -lpthread, it is a developer error. We certainly don't want to link libstdc++ against -lpthread unconditionally, just because somebody might want to use std::thread.