The following code segfaults if compiled statically using libpthread.a from
Fedora Core 4 (2.6.16-1.2107_FC4) with gcc-4.0.2, but will run ok if
dynamically linked to libpthread.so.0. Here the code:
#include list
#include pthread.h
void* tf (void* tp)
{
pthread_exit (0);
}
int main ()
{
std::list int l;
l.push_back (11);
pthread_t tid;
pthread_create (tid, 0, tf, 0);
pthread_detach (tid)
}
- Fails if compiled as: c++ -static thread.cc -o thread -lpthread
- Runs ok if compiled as: c++ thread.cc -o thread -pthread
Note that this code runs ok if I remove the 'push_back' line, whether static or
shared.
thanks for your help!
Philippe Thibault
--
Summary: libpthread.a core dump with STL
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe dot thibault at umontreal dot ca
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27641