This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26633] New: Minimal c++ program using threads and exceptions crashes when compiled statically
- From: "ahu at ds9a dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Mar 2006 16:14:37 -0000
- Subject: [Bug c++/26633] New: Minimal c++ program using threads and exceptions crashes when compiled statically
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The below does not crash with g++ 4.0.2, nor when removing -static:
(see also http://ds9a.nl/minimal.cc.txt)
#include <stdexcept>
/*
compiled with g++ 4.1.0 (g++ minimal.cc -o minimal -static -pthread), on
Ubuntu Breezy:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.0/configure --prefix=/opt/gcc-4.1/
--enable-shared --enable-__cxa_atexit --enable-libstdcxx-debug
Thread model: posix
gcc version 4.1.0
Crash:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16386 (LWP 8238)]
__gnu_internal::get_global () at
../../../../gcc-4.1.0/libstdc++-v3/libsupc++/eh_globals.cc:58
58 get_global() throw()
Current language: auto; currently c++
(gdb) bt
#0 __gnu_internal::get_global () at
../../../../gcc-4.1.0/libstdc++-v3/libsupc++/eh_globals.cc:58
#1 0x0804c767 in __cxa_get_globals () at
../../../../gcc-4.1.0/libstdc++-v3/libsupc++/eh_globals.cc:71
#2 0x0804c33f in __cxa_allocate_exception (thrown_size=8)
at ../../../../gcc-4.1.0/libstdc++-v3/libsupc++/eh_alloc.cc:154
#3 0x08048298 in doStuff ()
#4 0x080577af in pthread_start_thread (arg=0xaf5ffbe0) at manager.c:310
#5 0x08057827 in pthread_start_thread_event (arg=0xaf5ffbe0) at manager.c:334
#6 0x08069d9a in clone ()
*/
void *doStuff(void *)
try
{
throw std::runtime_error("boe");
}
catch(std::exception& e)
{}
int main()
{
pthread_t tid;
pthread_create(&tid, 0, doStuff,0);
void *result;
pthread_join(tid, &result);
}
--
Summary: Minimal c++ program using threads and exceptions crashes
when compiled statically
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ahu at ds9a dot nl
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26633