This is the mail archive of the gcc-patches@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]

Re: RFC: C++ PATCH to support dynamic initialization and destruction of C++11 and OpenMP TLS variables


On Wed, Oct 10, 2012 at 04:16:03PM -0400, Jack Howarth wrote:
> On Wed, Oct 10, 2012 at 04:50:22PM +0200, Rainer Orth wrote:
> > Jack Howarth <howarth@bromo.med.uc.edu> writes:
> > 
> > >    Have you tried a gcc trunk build on linux configured to use emutls instead
> > > of tls to confirm that this issue is really darwin-specific? These failures might
> > > also appear on sparc-sun-solaris2.9 but we don't have recent gcc trunk testresults
> > > for that. Perhaps Rainer can try a build of current gcc trunk and see if it
> > > impacts sparc-sun-solaris2.9's use of emutls as well.
> > >            Jack
> > 
> > There's no reason to test on a emutls-only target, just configure with
> > --disable-tls on any target.  I probably won't be able to test Solaris 9
> > (SPARC or x86) before the weekend.
> > 
> > 	Rainer
> 
> A quick build of gcc trunk (r192324) on Fedoa 15 x86_64 using --disable-tls shows...
> 
> Native configuration is x86_64-unknown-linux-gnu
> 
> 		=== gcc tests ===
> 
> 
> Running target unix
> 
> 		=== gcc Summary ===
> 
> # of expected passes		499
> # of unsupported tests		5
> /home/howarth/work-gcc/gcc/xgcc  version 4.8.0 20121010 (experimental) (GCC) 
> 
> 		=== g++ tests ===
> 
> 
> Running target unix
> FAIL: g++.dg/tls/thread_local3.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local3g.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local4.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local4g.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local5.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local5g.C -std=gnu++11 execution test
> FAIL: g++.dg/tls/thread_local7.C scan-assembler-not \\\\.data
> FAIL: g++.dg/tls/thread_local7g.C scan-assembler-not \\\\.data
> 
> 		=== g++ Summary ===
> 
> # of expected passes		105
> # of unexpected failures	8
> # of expected failures		2
> # of unsupported tests		6
> /home/howarth/work-gcc/gcc/testsuite/g++/../../g++  version 4.8.0 20121010 (experimental) (GCC) 
> 
> 
> Compiler version: 4.8.0 20121010 (experimental) (GCC) 
> Platform: x86_64-unknown-linux-gnu
> configure flags: --disable-ppl --disable-cloog --prefix=/home/howarth/dist-gcc --enable-languages=c,c++ --disable-multilib --disable-lto --disable-tls --disable-bootstrap
> 
> The first failure backtraces as...
> 
> $ gdb ./thread_local3.exe
> GNU gdb (GDB) Fedora (7.3.1-48.fc15)
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /home/howarth/work-gcc/gcc/testsuite/g++/thread_local3.exe...(no debugging symbols found)...done.
> (gdb) r
> Starting program: /home/howarth/work-gcc/gcc/testsuite/g++/thread_local3.exe 
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7ffff7aaa700 (LWP 27463)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffff7aaa700 (LWP 27463)]
> 0x0000000000000000 in ?? ()
> (gdb) bt
> #0  0x0000000000000000 in ?? ()
> #1  0x00007ffff7d50f44 in (anonymous namespace)::list::run() () at ../../../../gcc/libstdc++-v3/libsupc++/atexit_thread.cc:71
> #2  0x00000035e9e07933 in __nptl_deallocate_tsd () at pthread_create.c:156
> #3  0x00000035e9e07b4f in start_thread (arg=0x7ffff7aaa700) at pthread_create.c:312
> #4  0x00000035e96e0e6d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
> (gdb) 
> 
> 

Valgrind shows...

$ valgrind --leak-check=full ./thread_local3.exe
==27634== Memcheck, a memory error detector
==27634== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==27634== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==27634== Command: ./thread_local3.exe
==27634== 
==27634== Thread 2:
==27634== Invalid read of size 4
==27634==    at 0x4C69F20: (anonymous namespace)::list::run() (atexit_thread.cc:70)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634==  Address 0x595f390 is 16 bytes inside a block of size 536 free'd
==27634==    at 0x4A055FE: free (vg_replace_malloc.c:366)
==27634==    by 0x4F5512A: emutls_destroy (emutls.c:75)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634== 
==27634== Invalid read of size 8
==27634==    at 0x4C69F3D: (anonymous namespace)::list::run() (atexit_thread.cc:71)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634==  Address 0x595f398 is 24 bytes inside a block of size 536 free'd
==27634==    at 0x4A055FE: free (vg_replace_malloc.c:366)
==27634==    by 0x4F5512A: emutls_destroy (emutls.c:75)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634== 
==27634== Invalid read of size 8
==27634==    at 0x4C69F41: (anonymous namespace)::list::run() (atexit_thread.cc:71)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634==  Address 0x595f3a0 is 32 bytes inside a block of size 536 free'd
==27634==    at 0x4A055FE: free (vg_replace_malloc.c:366)
==27634==    by 0x4F5512A: emutls_destroy (emutls.c:75)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634== 
==27634== Invalid read of size 8
==27634==    at 0x4C69F49: (anonymous namespace)::list::run() (atexit_thread.cc:72)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634==  Address 0x595f388 is 8 bytes inside a block of size 536 free'd
==27634==    at 0x4A055FE: free (vg_replace_malloc.c:366)
==27634==    by 0x4F5512A: emutls_destroy (emutls.c:75)
==27634==    by 0x35E9E07932: __nptl_deallocate_tsd (pthread_create.c:156)
==27634==    by 0x35E9E07B4E: start_thread (pthread_create.c:312)
==27634==    by 0x35E96E0E6C: clone (clone.S:115)
==27634== 
==27634== 
==27634== HEAP SUMMARY:
==27634==     in use at exit: 824 bytes in 2 blocks
==27634==   total heap usage: 13 allocs, 11 frees, 2,794 bytes allocated
==27634== 
==27634== Thread 1:
==27634== 536 bytes in 1 blocks are possibly lost in loss record 2 of 2
==27634==    at 0x4A0649D: malloc (vg_replace_malloc.c:236)
==27634==    by 0x4F45A1B: emutls_alloc (emutls.c:102)
==27634==    by 0x4F551D3: __emutls_get_address (emutls.c:183)
==27634==    by 0x4C69F7F: (anonymous namespace)::run_current() (atexit_thread.cc:91)
==27634==    by 0x35E96388C0: __run_exit_handlers (exit.c:78)
==27634==    by 0x35E9638944: exit (exit.c:100)
==27634==    by 0x35E9621363: (below main) (libc-start.c:258)
==27634== 
==27634== LEAK SUMMARY:
==27634==    definitely lost: 0 bytes in 0 blocks
==27634==    indirectly lost: 0 bytes in 0 blocks
==27634==      possibly lost: 536 bytes in 1 blocks
==27634==    still reachable: 288 bytes in 1 blocks
==27634==         suppressed: 0 bytes in 0 blocks
==27634== Reachable blocks (those to which a pointer was found) are not shown.
==27634== To see them, rerun with: --leak-check=full --show-reachable=yes
==27634== 
==27634== For counts of detected and suppressed errors, rerun with: -v
==27634== ERROR SUMMARY: 9 errors from 5 contexts (suppressed: 6 from 6)


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