gnu/64231: libstdc++ on FreeBSD 5.2+ is non-usable in threaded apps
Alex Kotov
al_kotov at yahoo.com
Sat Mar 13 13:30:19 PST 2004
>Number: 64231
>Category: gnu
>Synopsis: libstdc++ on FreeBSD 5.2+ is non-usable in threaded apps
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Mar 13 13:30:18 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Alex Kotov
>Release: 5.2.1-RELEASE
>Organization:
n/a
>Environment:
FreeBSD some.hostname.com 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Fri Mar 12 11:10:30 EST 2004 root@:/usr/src/sys/i386/compile/BACKUP i386
>Description:
Using libstdc++ with threaded apps leads to segmentation faults if application is statically linked and misterious hangs if application is dynamically linked (actually supplied example illustrate only first problem - second problem requires much more code for demonstration).
>How-To-Repeat:
// BUILD: gcc -pthread -D_THREAD_SAFE test.cc -o test -lstdc++ -static
// AND TRY TO START IT!
#include <pthread.h>
#include <string>
using namespace std;
volatile int a = 0;
void *threadproc( void *arg ) {
for( int i = 0; i < 10000; i++ ) {
a++;
}
return NULL;
}
int main( int argc, char *argv[] ) {
pthread_t tt;
// oops...
int r = pthread_create( &tt, NULL, threadproc, 0 );
sleep( 10 );
return 0;
}
>Fix:
Properly compiled stlport should be used in threaded apps until mantainers will fix the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list