Executing on host: /test/gnu/gcc/objdir/gcc/xgcc -B/test/gnu/gcc/objdir/gcc/ /te st/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f -B/test/gnu/gcc/objd ir/hppa2.0w-hp-hpux11.11/./libgomp/ -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11 /./libgomp -I/test/gnu/gcc/gcc/libgomp/testsuite/.. -fmessage-length=0 -fopenmp -O0 -L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgomp/.libs -lgomp -L/ test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgomp/../libgfortran/.libs -lgfort ranbegin -lgfortran -lm -o ./pr25162.exe (timeout = 300) PASS: libgomp.fortran/pr25162.f -O0 (test for excess errors) Setting LD_LIBRARY_PATH to .:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgom p/.libs:/test/gnu/gcc/objdir/gcc:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./li bgomp/../libgfortran/.libs:.:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgom p/.libs:/test/gnu/gcc/objdir/gcc:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./li bgomp/../libgfortran/.libs FAIL: libgomp.fortran/pr25162.f -O0 execution test Fails at all optimizations. (gdb) r Starting program: /test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libgomp/testsuite/pr25162.xg warning: Private mapping of shared library text was not specified by the executable; setting a breakpoint in a shared library which is not privately mapped will not work. See the HP-UX 11i v3 chatr manpage for methods to privately map shared library text. [New process 21031, lwp 174348] [process 21031, lwp 174348 exited] [New process 21031, lwp 174349] [process 21031, lwp 174349 exited] [New process 21031, lwp 174350] [process 21031, lwp 174350 exited] [New process 21031, lwp 174351] [process 21031, lwp 174351 exited] Program received signal SIGBUS, Bus error. 0x00002eec in test1_ () at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:14 14 BPRIM( I ) = DBLE( I ) Current language: auto; currently fortran (gdb) bt #0 0x00002eec in test1_ () at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:14 #1 0x00002e48 in MAIN__ () at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:5 #2 0x00003278 in main (argc=1, argv=0x0) at ../../../gcc/libgfortran/fmain.c:21 (gdb) disass 0x00002edc 0x00002efc Dump of assembler code from 0x2edc to 0x2efc: 0x00002edc <test1_+100>: nop 0x00002ee0 <test1_+104>: copy ret0,r19 0x00002ee4 <test1_+108>: depw,z r4,28,29,ret0 0x00002ee8 <test1_+112>: add,l ret0,r19,ret0 0x00002eec <test1_+116>: fstd fr12,0(ret0) 0x00002ef0 <test1_+120>: ldw 8(r3),r19 0x00002ef4 <test1_+124>: ldi 64,ret0 0x00002ef8 <test1_+128>: cmpclr,<> ret0,r19,ret0 End of assembler dump. (gdb) p/x $ret0 $1 = 0x4000f494 The address is aligned to a 4-byte boundary for an 8-byte store. This address is returned by the call to __emutls_get_address.
emutls_alloc is called with the following struct __emutls_object *: (gdb) emutls_alloc (obj=0x400011d0) at ../../../gcc/libgcc/../gcc/emutls.c:95 95 { (gdb) p/x $r26 $7 = 0x400011d0 (gdb) p *(struct __emutls_object *) $r26 $8 = {size = 0, align = 0, loc = {offset = 2, ptr = 0x2}, templ = 0x0} As a result, this code is executed in emutls_alloc: /* We could use here posix_memalign if available and adjust emutls_destroy accordingly. */ if (obj->align <= sizeof (void *)) { ptr = malloc (obj->size + sizeof (void *)); if (ptr == NULL) abort (); ((void **) ptr)[0] = ptr; ret = ptr + sizeof (void *); } This causes the unaligned pointer. (gdb) bt #0 emutls_alloc (obj=0x400011d0) at ../../../gcc/libgcc/../gcc/emutls.c:104 #1 0x7ad79a04 in __emutls_get_address (obj=0x400011d0) at ../../../gcc/libgcc/../gcc/emutls.c:180 #2 0x00002ee0 in test1_ () at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:14 #3 0x00002e48 in MAIN__ () at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:5 #4 0x00003278 in main (argc=1, argv=0xf100000) at ../../../gcc/libgfortran/fmain.c:21 As far as I can see, the obj passed to __emutls_get_address is never initialized. The call assembler is: addil LR'__emutls_v.testcom_-$global$,%r27 copy %r1,%r28 ldo RR'__emutls_v.testcom_-$global$(%r28),%r26 .CALL ARGW0=GR bl __emutls_get_address,%r2 nop __emutls_v.testcom_ is allocated in the $BSS$ subspace: .SPACE $PRIVATE$ .SUBSPA $BSS$ __emutls_v.testcom_ .comm 16 This is a regression, at least a testcase regression, because the tls tests were previously skipped on this target.
Subject: Re: FAIL: libgomp.fortran/pr25162.f Attached full .s file. Dave
Created attachment 16781 [details] pr25162.s
Size of __emutls_v.testcom_ block is wrong, as well as generated code.
(gdb) p debug_tree ($r26) <var_decl 7af33e18 __emutls_v.testcom_ type <record_type 7af7ec30 __emutls_object BLK size <integer_cst 7af2b760 constant 128> unit size <integer_cst 7af2b780 constant 16> align 32 symtab 0 alias set -1 canonical type 7af7ec30 fields <field_decl 7af78480 __size type <integer_type 7af35340 character(kind=4)> unsigned SI file /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f line 14 col 0 size <integer_cst 7af2b520 constant 32> unit size <integer_cst 7af2b2c0 constant 4> align 32 offset_align 64 offset <integer_cst 7af2b2e0 constant 0> bit offset <integer_cst 7af2b860 constant 0> context <record_type 7af7ec30 __emutls_object> chain <field_decl 7af78420 __align>>> addressable asm_written public static ignored common BLK file /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f line 14 col 0 size <integer_cst 7af2b760 128> unit size <integer_cst 7af2b780 16> align 32 context <function_decl 7af7b400 test1> (mem/s/c:BLK (symbol_ref:SI ("__emutls_v.testcom_") [flags 0x200] <var_decl 7af33e18 __emutls_v.testcom_>) [0 __emutls_v.testcom_+0 S16 A32])>
(gdb) p debug_tree (decl) <var_decl 7af331b8 testcom type <record_type 7af79af8 BLK size <integer_cst 7af775c0 constant 6400> unit size <integer_cst 7af7ac40 constant 800> align 64 symtab 0 alias set -1 canonical type 7af79af8 fields <field_decl 7af781e0 bprim type <array_type 7af797b8> BLK file /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f line 9 col 0 size <integer_cst 7af775c0 6400> unit size <integer_cst 7af7ac40 800> align 64 offset_align 64 offset <integer_cst 7af2b2e0 constant 0> bit offset <integer_cst 7af2b860 constant 0> context <record_type 7af79af8>>> addressable public static ignored common tls-local-exec decl_3 BLK defer-output file /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f line 10 col 0 size <integer_cst 7af775c0 6400> unit size <integer_cst 7af7ac40 800> align 64 context <function_decl 7af7b400 test1> chain <function_decl 7af7b400 test1>>
Subject: Bug 38283 Author: danglin Date: Sun Nov 30 16:35:59 2008 New Revision: 142293 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142293 Log: PR middle-end/38283 * varasm.c (emutls_finish): Fix common registration. Modified: trunk/gcc/ChangeLog trunk/gcc/varasm.c
Fixed.