Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2001 08:50:41 -0800 (PST)
From:      dor@cwnt.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/24721: libgcc_r problem - library precedence with libstdc++
Message-ID:  <200101291650.f0TGofU88365@freefall.freebsd.org>

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

>Number:         24721
>Category:       bin
>Synopsis:       libgcc_r problem - library precedence with libstdc++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 29 09:00:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dor Laor
>Release:        4.2-release
>Organization:
Charlotte WEB
>Environment:
FreeBSD simba.cwnt.co.il 4.2-RELEASE FreeBSD 4.2-RELEASE #2: Wed Jan 17 16:22:29 GMT 2001     barak@simba.cwnt.co.il:/usr/src/sys/compile/COMPAQ_DL360  i386

>Description:
The attached program creates cores using normal compilation & linking .
The compilation command is:
g++ -g3 try.cpp -pthread -o try

// file try.cpp

#include <sys/types.h>
#include <strstream.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <pthread.h>


class a {
public:
    a() {
        a1 = 0;
    }
    ~a() {
        int i;
        int a2[100];
        for (i = 0; i < 100 ; i++) {
            a2[i] = i;
        }
        a1 = a2[0];
    }
    int a1;
};

class b : a {
    int b1;
};

void func(void* arg) {
    int i;
    for (i=0;i<100000;i++) {
        b obj;
        b* p;
        p = &obj;
    }
    printf("thread done\n");
}

void thread_creation(int i) {
    int rtn = 0;

    pthread_t id;
    if (rtn = pthread_create(&id, 0, (void * (*)(void *))func,NULL)) {
        printf(" could create thread\n");
    }
}


int main() {

    for (int i=0; i< 100; i++) {
        thread_creation(i);
    }


    sleep(10);

    return 0;
}



>How-To-Repeat:
Just run the program several times.
>Fix:
Link libgcc_r implictly with the executable- use command

g++ -g3 try.cpp -pthread -lgcc_r -o try


Note that if you put libstdc++ before gcc_r the problem remains


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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