https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63908

--- Comment #3 from leimaohui <leimaohui at cn dot fujitsu.com> ---
Thanks for joseph's reply.

But I found the reason is the founction "pthread_exit(0)" can't execut
normally。
Because it will lead a SIGABRT signal and aborted .

I wrote a test program and make a test.The enviroment is below:
------------------------------------------------
rootfs: 
http://downloads.yoctoproject.org/releases/yocto/yocto-1.7/machines/p1022ds/core-image-sato-sdk-p1022ds-20141018182842.rootfs.tar.gz

toolchain:
http://downloads.yoctoproject.org/releases/yocto/yocto-1.7/toolchain/x86_64/poky-glibc-x86_64-core-image-sato-ppce500v2-toolchain-1.7.sh

kernel: 3.14 and 3.4.74 have the same appearance

hostOS: RHEL 6.3

Below is my test program
------------------------------------------------

[root@RHEL6U3 pthread-test]# cat pthread-test.c
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>

pthread_t       tid1, tid2;
void            *tret;

void *
thr_fn1(void *arg)
{
    sleep(1);

    printf("it's thread 1 \n");
    pthread_exit(0);

//    pthread_join(tid2, &tret);
}

int
main(void)
{
    int err;

    err = pthread_create(&tid1, NULL, thr_fn1, NULL);
    if (err != 0)
        printf("can't create thread 1\n");

    printf("I will join thread 1... 1\n");
    err = pthread_join(tid1, &tret);
    if (err != 0)
        printf("can't join with thread 1\n");

    printf("thread 1 exit code %d\n", (int)tret);
}
[root@RHEL6U3 pthread-test]#.
/opt/poky/1.7/environment-setup-ppce500v2-poky-linux-gnuspe
[root@RHEL6U3 pthread-test]# ${CC} pthread-test.c -lpthread -o pthread-test

------------------------------------------------
And then execut "pthread-test" in e500v2.The result is like below
------------------------------------------------

root@p1022ds:/root# strace -f -o pthread-test.log ./pthread-test
I will join thread 1... 1
it's thread 1
Aborted
root@p1022ds:/root# cat pthread-test.log
...
1009  futex(0xfa999ac, FUTEX_WAKE_PRIVATE, 2147483647) = 0
1009  rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
1009  tgkill(1008, 1009, SIGABRT)       = 0
1009  --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=1008, si_uid=0}
---
1009  +++ killed by SIGABRT +++
1008  +++ killed by SIGABRT +++
root@p1022ds:/root# 
root@p1022ds:/root# 

But I dont't know the root cause. That's the gcc 's bug or the glibc's bug?

Reply via email to