Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Mar 2004 13:30:07 -0800 (PST)
From:      Alex Kotov <al_kotov@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   gnu/64231: libstdc++ on FreeBSD 5.2+ is non-usable in threaded apps
Message-ID:  <200403132130.i2DLU7IK018753@www.freebsd.org>
Resent-Message-ID: <200403132130.i2DLUIae061990@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403132130.i2DLU7IK018753>