A Bug of gfortran, g77 and g95 on default optimization
Sunjoong Lee
sunjoong@gmail.com
Mon Jun 18 13:38:00 GMT 2007
I had compiled a legacy fortran77 code and foud a bug;
$ gfortran -o TMalign TMalign.f
$ ./TMalign 1aquA.pdb 1avaC.pdb | grep ^Ali
Aligned length= 89, RMSD= 6.41, TM-score= 0.24257, ID=0.042
$ gfortran -O0 -o TMalign TMalign.f
$ ./TMalign 1aquA.pdb 1avaC.pdb | grep ^Ali
Aligned length= 91, RMSD= 6.35, TM-score=0.24762 , ID=0.024
$ pgf77 -O1 -o TMalign TMalign.f
$ ./TMalign 1aquA.pdb 1avaC.pdb | grep ^Ali
Aligned length= 91, RMSD= 6.35, TM-score=0.24762, ID= 0.024
$ pgf77 -O0 -o TMalign TMalign.f
$ ./TMalign 1aquA.pdb 1avaC.pdb | grep ^Ali
Aligned length= 91, RMSD= 6.35, TM-score=0.24762, ID=0.024
That optimization error is on a bellow subroutine;
********************************************************************
* Dynamic programming for alignment.
* Input: score(i,j), and gap_open
* Output: invmap(j)
********************************************************************
SUBROUTINE DP(NSEQ1,NSEQ2)
PARAMETER(nmax=5000)
LOGICAL*1 DIR
common/dpc/score(nmax,nmax),gap_open,invmap(nmax)
dimension DIR(0:nmax,0:nmax),VAL(0:nmax,0:nmax)
REAL H,V
*** initialize the matrix:
val(0,0)=0
do i=1,nseq1
dir(i,0)=.false.
val(i,0)=0
enddo
do j=1,nseq2
dir(0,j)=.false.
val(0,j)=0
invmap(j)=-1
enddo
*** decide matrix and path:
DO j=1,NSEQ2
DO i=1,NSEQ1
D=VAL(i-1,j-1)+SCORE(i,j)
H=VAL(i-1,j)
if(DIR(i-1,j))H=H+GAP_OPEN
V=VAL(i,j-1)
if(DIR(i,j-1))V=V+GAP_OPEN
IF(( D.GE.H).AND.(D.GE.V)) THEN
DIR(I,J)=.true.
VAL(i,j)=D
ELSE
DIR(I,J)=.false.
if(V.GE.H)then
val(i,j)=v
else
val(i,j)=h
end if
ENDIF
ENDDO
ENDDO
*** extract the alignment:
i=NSEQ1
j=NSEQ2
DO WHILE((i.GT.0).AND.(j.GT.0))
IF(DIR(i,j))THEN
invmap(j)=i
i=i-1
j=j-1
ELSE
H=VAL(i-1,j)
if(DIR(i-1,j))H=H+GAP_OPEN
V=VAL(i,j-1)
if(DIR(i,j-1))V=V+GAP_OPEN
IF( V.GE.H) THEN
j=j-1
ELSE
i=i-1
ENDIF
ENDIF
ENDDO
c^^^^^^^^^^^^^^^Dynamical programming done ^^^^^^^^^^^^^^^^^^^
return
END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1aquA.pdb
Type: chemical/x-pdb
Size: 193594 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070618/47824950/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1avaC.pdb
Type: chemical/x-pdb
Size: 113728 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070618/47824950/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TMalign.f
Type: application/octet-stream
Size: 76072 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070618/47824950/attachment.obj>
More information about the Fortran
mailing list