https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77982
--- Comment #1 from Pawel Sikora <pawel_sikora at zoho dot com> --- Created attachment 39842 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39842&action=edit reduced testcase. % gdb ./m GNU gdb (GDB) Fedora 7.11.1-86.fc24 (gdb) r Starting program: /home/pawels/src/bug/m [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". initializing library... [New Thread 0x7ffff34ff700 (LWP 26786)] ^C Thread 1 "m" received signal SIGINT, Interrupt. __sanitizer::internal_sched_yield () at ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc:304 304 } (gdb) thread apply all bt Thread 2 (Thread 0x7ffff34ff700 (LWP 26786)): #0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 #1 0x00007ffff5baea76 in __GI___pthread_mutex_lock (mutex=0x7ffff7ffd908 <_rtld_local+2312>) at ../nptl/pthread_mutex_lock.c:115 #2 0x00007ffff7deb6da in tls_get_addr_tail (ti=0x7ffff7163b30, dtv=0x61200000bed0, the_map=0x7ffff7ff7658) at dl-tls.c:765 #3 0x00007ffff6e68f4b in __interceptor___tls_get_addr (arg=0x7ffff7163b30) at ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4207 #4 0x00007ffff6f21ec4 in __lsan::DisabledInThisThread () at ../../../../libsanitizer/lsan/lsan_common.cc:33 #5 0x00007ffff6e62815 in __asan::Allocator::Allocate (this=0x7ffff7166d20 <__asan::instance>, size=<optimized out>, alignment=<optimized out>, stack=0x7ffff34fe430, alloc_type=<optimized out>, can_fill=<optimized out>) at ../../../../libsanitizer/asan/asan_allocator.cc:449 #6 0x00007ffff6efe1d1 in __interceptor_realloc (ptr=0x0, size=32) at ../../../../libsanitizer/asan/asan_malloc_linux.cc:83 #7 0x00007ffff5bae035 in pthread_getattr_np (thread_id=<optimized out>, attr=attr@entry=0x7ffff34fed90) at pthread_getattr_np.c:161 #8 0x00007ffff6f179fd in __sanitizer::GetThreadStackTopAndBottom (at_initialization=at_initialization@entry=false, stack_top=stack_top@entry=0x7ffff34fee18, stack_bottom=stack_bottom@entry=0x7ffff34fee20) at ../../../../libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:112 #9 0x00007ffff6f17f5e in __sanitizer::GetThreadStackAndTls (main=<optimized out>, stk_addr=stk_addr@entry=0x7ffff7f88020, stk_size=stk_size@entry=0x7ffff7f88028, tls_addr=tls_addr@entry=0x7ffff7f88030, tls_size=tls_size@entry=0x7ffff34fee70) at ../../../../libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:388 #10 0x00007ffff6f0b675 in __asan::AsanThread::SetThreadStackAndTls (this=this@entry=0x7ffff7f88000) at ../../../../libsanitizer/asan/asan_thread.cc:197 #11 0x00007ffff6f0b8a2 in __asan::AsanThread::Init (this=this@entry=0x7ffff7f88000) at ../../../../libsanitizer/asan/asan_thread.cc:153 #12 0x00007ffff6f0ba68 in __asan::AsanThread::ThreadStart (this=0x7ffff7f88000, os_id=26786, signal_thread_is_registered=0x7fffffffc428) at ../../../../libsanitizer/asan/asan_thread.cc:166 #13 0x00007ffff5bac5ca in start_thread (arg=0x7ffff34ff700) at pthread_create.c:333 #14 0x00007ffff62cff6d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 Thread 1 (Thread 0x7ffff7fcf780 (LWP 26778)): #0 __sanitizer::internal_sched_yield () at ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc:304 #1 0x00007ffff6e685c5 in __interceptor_pthread_create (thread=0x7fffffffccb0, attr=<optimized out>, start_routine=0x7ffff7fdbb60 <threadFn(void*)>, arg=0x0) at ../../../../libsanitizer/asan/asan_interceptors.cc:256 #2 0x00007ffff7fdbc02 in startPolling () at s.cpp:19 #3 0x00007ffff7de8d8a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffdb88, env=env@entry=0x7fffffffdb98) at dl-init.c:72 #4 0x00007ffff7de8e9b in call_init (env=0x7fffffffdb98, argv=0x7fffffffdb88, argc=1, l=<optimized out>) at dl-init.c:30 #5 _dl_init (main_map=main_map@entry=0x61a00001f280, argc=1, argv=0x7fffffffdb88, env=0x7fffffffdb98) at dl-init.c:120 #6 0x00007ffff7deda91 in dl_open_worker (a=a@entry=0x7fffffffcfb0) at dl-open.c:564 #7 0x00007ffff7de8c34 in _dl_catch_error (objname=objname@entry=0x7fffffffcfa0, errstring=errstring@entry=0x7fffffffcfa8, mallocedp=mallocedp@entry=0x7fffffffcf9f, operate=operate@entry=0x7ffff7ded640 <dl_open_worker>, args=args@entry=0x7fffffffcfb0) at dl-error.c:187 #8 0x00007ffff7decfe9 in _dl_open (file=0x400900 "./s.so", mode=-2147483647, caller_dlopen=0x7ffff6e7e454 <__interceptor_dlopen(char const*, int)+116>, nsid=-2, argc=<optimized out>, argv=<optimized out>, env=0x7fffffffdb98) at dl-open.c:649 #9 0x00007ffff5fc9f09 in dlopen_doit (a=a@entry=0x7fffffffd1e0) at dlopen.c:66 #10 0x00007ffff7de8c34 in _dl_catch_error (objname=0x7ffff73848b0 <alloc_memory_for_dlsym+16>, errstring=0x7ffff73848b8 <alloc_memory_for_dlsym+24>, mallocedp=0x7ffff73848a8 <alloc_memory_for_dlsym+8>, operate=0x7ffff5fc9eb0 <dlopen_doit>, args=0x7fffffffd1e0) at dl-error.c:187 #11 0x00007ffff5fca591 in _dlerror_run (operate=operate@entry=0x7ffff5fc9eb0 <dlopen_doit>, args=args@entry=0x7fffffffd1e0) at dlerror.c:163 #12 0x00007ffff5fc9fa2 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87 #13 0x00007ffff6e7e454 in __interceptor_dlopen (filename=0x400900 "./s.so", flag=1) at ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4968 #14 0x0000000000400809 in main () at m.cpp:4