------- Comment #6 from danglin at gcc dot gnu dot org 2008-12-10 18:10 -------
On hppa64, I see a "random" segfault in crayptr2.f90 compiled at -O0:
(gdb) r
Starting program:
/mnt/gnu/gcc/objdir/hppa64-hp-hpux11.11/libgomp/testsuite/crayptr2.xg0
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.
warning: Loadable segment ".tbss" outside of ELF segments
warning: Loadable segment ".tbss" outside of ELF segments
warning: Loadable segment ".tbss" outside of ELF segments
[New process 28502, lwp 2270431]
[process 28502, lwp 2270431 exited]
[New process 28502, lwp 2270432]
[process 28502, lwp 2270432 exited]
[New process 28502, lwp 2270433]
[process 28502, lwp 2270433 exited]
[New process 28502, lwp 2270434]
[New process 28502, lwp 2270435]
[New process 28502, lwp 2270436]
Program received signal SIGSEGV, Segmentation fault.
[Switching to process 28502, lwp 2270435]
0x4000000000002d08 in MAIN__.omp_fn.0 (.omp_data_i=Cannot access memory at
address 0x0
)
at /mnt/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/crayptr2.f90:23
23 l = p .ne. omp_get_thread_num () + 1
Current language: auto; currently fortran
(gdb) p/x $pc
$1 = 0x4000000000002d08
(gdb) disass 0x4000000000002cf8 0x4000000000002d18
Dump of assembler code from 0x4000000000002cf8 to 0x4000000000002d18:
0x4000000000002cf8 <MAIN__.omp_fn.0+136>: b,l 0x4000000000002b2c
<.stub+60>,rp
0x4000000000002cfc <MAIN__.omp_fn.0+140>: nop
0x4000000000002d00 <MAIN__.omp_fn.0+144>: copy r4,dp
0x4000000000002d04 <MAIN__.omp_fn.0+148>: ldd 0(ret0),ret0
0x4000000000002d08 <MAIN__.omp_fn.0+152>: ldw 0(ret0),ret0
0x4000000000002d0c <MAIN__.omp_fn.0+156>: extrd,s ret0,63,32,ret0
0x4000000000002d10 <MAIN__.omp_fn.0+160>: stw r0,18(r3)
0x4000000000002d14 <MAIN__.omp_fn.0+164>: cmpb,=,n
ret0,r5,0x4000000000002d20 <MAIN__.omp_fn.0+176>
End of assembler dump.
(gdb) p/x $ret0
$2 = 0x0
This results from the code loading indirectly data with a the pointer
returned from a call to __emutls_get_address:
addil LT'__emutls_v.ip.565,%r27
copy %r1,%r28
ldd RT'__emutls_v.ip.565(%r28),%r28
copy %r28,%r26
ldo -48(%r30),%r29
copy %r27,%r4
b,l __emutls_get_address,%r2
nop
copy %r4,%r27
ldd 0(%r28),%r28
ldw 0(%r28),%r28
Is darwin also using EMUTLS?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35677