This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcc/69998] New: GCC5.3.0 _Unwind_ForcedUnwind Always Abort While pthread_exit


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

            Bug ID: 69998
           Summary: GCC5.3.0 _Unwind_ForcedUnwind Always Abort While
                    pthread_exit
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tcliuqiang at msn dot com
  Target Milestone: ---

Hello GCC team.

I build the cross toolchain for c,c++ myself (for multiple architectures like
x86, arm, powerpc, mips).  One thing really confuse me for several weeks.
The pthreads can not exit normally instead of abort and the whole program
terminated by the abort.

the example Python3 code:
import threading
def xx():print("hello,world")

th=threading.Thread(target=xx)
th.start()

And the result of running this code in python3 interactive mode:
~ # python3
Python 3.3.5 (default, Feb 27 2016, 19:04:46) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> def xx():print("hello,world")
... 
>>> th=threading.Thread(target=xx)
>>> th.start()
hello,world
>>> Aborted
~ # 
~ # 
And then I get the backtrace from gdb:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff61a8700 (LWP 133)]
0x00007ffff6cdd348 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff6cdd348 in raise () from /lib/libc.so.6
#1  0x00007ffff6cde7ca in abort () from /lib/libc.so.6
#2  0x00007ffff57a2a57 in uw_init_context_1
(context=context@entry=0x7ffff61a7cc0, 
    outer_cfa=outer_cfa@entry=0x7ffff61a7ef0, outer_ra=0x7ffff7766c10
<__pthread_unwind+64>)
    at /develop/build/toolchain/src/gcc-5.3.0/libgcc/unwind-dw2.c:1563
#3  0x00007ffff57a3046 in _Unwind_ForcedUnwind (exc=0x7ffff61a8d70,
stop=0x7ffff7766a90 <unwind_stop>, 
    stop_argument=0x7ffff61a7f70) at
/develop/build/toolchain/src/gcc-5.3.0/libgcc/unwind.inc:201
#4  0x00007ffff7766c10 in __pthread_unwind () from /lib/libpthread.so.0
#5  0x00007ffff775f525 in pthread_exit () from /lib/libpthread.so.0
#6  0x00007ffff7aa614f in PyThread_exit_thread () at
Python/thread_pthread.h:266
#7  0x00007ffff7aaa766 in t_bootstrap (boot_raw=0x700380) at
./Modules/_threadmodule.c:1023
#8  0x00007ffff775e3e4 in start_thread () from /lib/libpthread.so.0
#9  0x00007ffff6d9179d in clone () from /lib/libc.so.6

I check the libgcc code, and can not find anything useful.

THE SAME THING happened for GCC4.9.2/4.9.3 WHICH I TESTED.

uw_init_context_1 (struct _Unwind_Context *context,
                   void *outer_cfa, void *outer_ra)
{
  void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
  _Unwind_FrameState fs;
  _Unwind_SpTmp sp_slot;
  _Unwind_Reason_Code code;

  memset (context, 0, sizeof (struct _Unwind_Context));
  context->ra = ra;
  if (!ASSUME_EXTENDED_UNWIND_CONTEXT)
    context->flags = EXTENDED_CONTEXT_BIT;

  code = uw_frame_state_for (context, &fs);  
  gcc_assert (code == _URC_NO_REASON);


The followed is cross compiler info:
work:Project$ x86_64-linux-gcc -v -save-temps test.c -o /develop/tmp/test/test
äçåå specsã
COLLECT_GCC=x86_64-linux-gcc
COLLECT_LTO_WRAPPER=/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/lto-wrapper
çæïx86_64-ltriangle-linux-gnu
éçäï/develop/build/toolchain/src/gcc-5.3.0/configure
--target=x86_64-ltriangle-linux-gnu
--prefix=/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23 CFLAGS=-O2
CXXFLAGS=-O2 --enable-languages=c,c++ --disable-multilib
--with-bugurl=tcliuqiang@gmail.com --enable-__cxa_atexit --enable-threads=posix
--enable-nls --enable-c99 --with-gnu-as --with-gnu-ld --enable-shared
--enable-checking=release --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-tune=generic --with-arch_32=i686
ççæåïposix
gcc çæ 5.3.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' '/develop/tmp/test/test'
'-mtune=generic' '-march=x86-64'

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/cc1
-E -quiet -v test.c -mtune=generic -march=x86-64 -fpch-preprocess -o test.i
åçäååççåâ/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/sys-includeâ
#include "..." æçäèéååï
#include <...> æçäèéååï

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/include

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/include-fixed

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/include
æçåèçæã
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' '/develop/tmp/test/test'
'-mtune=generic' '-march=x86-64'

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/cc1
-fpreprocessed test.i -quiet -dumpbase test.c -mtune=generic -march=x86-64
-auxbase test -version -o test.s
GNU C11 (GCC) çæ 5.3.0 (x86_64-ltriangle-linux-gnu)
        ç GNU C çæ 4.8.4 çèïGMP çæ 5.1.3ïMPFR çæ 3.1.2ïMPC çæ 1.0.3
GGC ååï--param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C11 (GCC) çæ 5.3.0 (x86_64-ltriangle-linux-gnu)
        ç GNU C çæ 4.8.4 çèïGMP çæ 5.1.3ïMPFR çæ 3.1.2ïMPC çæ 1.0.3
GGC ååï--param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cfc8a24119de5d8668aaec51f2238124
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' '/develop/tmp/test/test'
'-mtune=generic' '-march=x86-64'

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/bin/as
-v --64 -o test.o test.s
GNU assembler version 2.26 (x86_64-ltriangle-linux-gnu) using BFD version (GNU
Binutils) 2.26.20160125
COMPILER_PATH=/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/bin/
LIBRARY_PATH=/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/../lib64/:/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' '/develop/tmp/test/test'
'-mtune=generic' '-march=x86-64'

/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/collect2
-plugin
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/liblto_plugin.so
-plugin-opt=/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/libexec/gcc/x86_64-ltriangle-linux-gnu/5.3.0/lto-wrapper
-plugin-opt=-fresolution=test.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
/develop/tmp/test/test
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/crt1.o
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/crti.o
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/crtbegin.o
-L/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0
-L/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/../lib64
-L/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib
test.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/crtend.o
/develop/build/toolchain/release/x86_64_gcc5.3.0_glibc2.23/lib/gcc/x86_64-ltriangle-linux-gnu/5.3.0/../../../../x86_64-ltriangle-linux-gnu/lib/crtn.o
work:Project$

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]