identified bug in g77 on Alpha
Jean-Paul Jeannot
jeannot@gx-tech.fr
Fri Apr 17 05:13:00 GMT 1998
Dear Sir,
You will find below the assembly code of a simple Fortran routine which
crashes with segmentation fault when storing the first element
in( jT_f-hd_T ) = Xsp
whereas everything is fine when commenting this line.
The assembly code (generated with
-ffast-math -fexpensive-optimizations -fomit-frame-pointer -fno-inline
or with -O5)
uses a zapnot instruction to copy an address.
BUT the zapnot parameter is 15 (copuing 4 bytes) instead of 255 (to copy
8 bytes).
I guess this is typically a 64 bit issue. As, from my understanding,
zapnots are used a lot to copy registers, this may create problems
elsewhere.
Thanks for your help
Jean-Paul Jeannot
---------------------------------------------------------------------
.file 1 "simul_trace.F"
.version "01.01"
.set noat
gcc2_compiled.:
__gnu_compiled_f77:
.text
.align 3
.globl simul_trace__
.ent simul_trace__
simul_trace__:
ldgp $29,0($27)
$simul_trace__..ng:
.frame $30,0,$26,0
.prologue 1
lda $3,idim_
lds $f1,0($17) # Xsp
ldl $5,0($3) # jT_f
ldl $4,76($3) # hd_T
ldl $1,0($3) # jT_f
ldl $2,76($3) # hd_T
subl $5,$4,$5 # jT_f - hd_T of array declaration
subq $1,$2,$1 # jT_f - hd_T of array assignment
# THE CULPRIT: 15 is not enough for a 64 bit address!
zapnot $5,15,$2
# besides: why copy $5 to $2 here...
subq $1,$2,$1
s4addq $1,$16,$1 # in(..
sts $f1,0($1) <=== segmentation fault here
ldl $1,0($3)
ldl $2,76($3)
lds $f1,0($18) # Ysp
subq $1,$2,$1
subq $1,$5,$1 # this one is fine: $5 used directly
s4addq $1,$16,$1 # in(..
sts $f1,4($1)
ldl $1,0($3)
ldl $2,76($3)
lds $f1,0($19) # Xrcv
subq $1,$2,$1
subq $1,$5,$1
s4addq $1,$16,$1 # in(..
sts $f1,8($1)
ldl $1,0($3)
ldl $2,76($3)
lds $f1,0($20) # Yrcv
subq $1,$2,$1
subq $1,$5,$1
s4addq $1,$16,$1 # in(..
sts $f1,12($1)
ret $31,($26),1
.end simul_trace__
.comm idim_,96,8
.ident "GCC: (GNU) egcs-2.90.27 980315 (egcs-1.0.2 release)"
# subroutine simul_trace( in, Xsp, Ysp, Xrcv, Yrcv )
# common /Idim/ jT_f, jT_l, nT, nT_dim
# common /Idim/ jZ_f, jZ_l, nZ, nZ_dim
# common /Idim/ jZ2_f, jZ2_l, nZ2, nZ2_dim
# common /Idim/ jzs_f, jzs_l, nzs, nzs_dim, l_amp
# common /Idim/ hd_S, hd_Z, hd_T
# common /Idim/ nlay, nlayz
# common /Idim/ n_work
# common /Idim/ nb_calls
# real Xsp, Ysp, Xrcv, Yrcv
# real in( jT_f-hd_T : jT_l )
# in( jT_f-hd_T ) = Xsp
# in( jT_f-hd_T + 1 ) = Ysp
# in( jT_f-hd_T + 2 ) = Xrcv
# in( jT_f-hd_T + 3 ) = Yrcv
# end
More information about the Gcc-bugs
mailing list