public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32391]  New: Default optimization (level 1) bug of loop optimization (maybe)
@ 2007-06-18 14:12 sunjoong at gmail dot com
  2007-06-18 14:19 ` [Bug fortran/32391] " sunjoong at gmail dot com
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: sunjoong at gmail dot com @ 2007-06-18 14:12 UTC (permalink / raw)
  To: gcc-bugs

This bug occurs on gfortran 4.1 and 4.2 .
I think it is not a gfortran specific bug; I checked g77 and g95 on gcc 3.4.6..


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 


Files;

http://zhang.bioinformatics.ku.edu/TM-align/TMalign.f
http://zhang.bioinformatics.ku.edu/TM-align/benchmark/1aquA.pdb
http://zhang.bioinformatics.ku.edu/TM-align/benchmark/1avaC.pdb


-- 
           Summary: Default optimization (level 1) bug of loop optimization
                    (maybe)
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sunjoong at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32391


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2007-06-21  9:15 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18 14:12 [Bug fortran/32391] New: Default optimization (level 1) bug of loop optimization (maybe) sunjoong at gmail dot com
2007-06-18 14:19 ` [Bug fortran/32391] " sunjoong at gmail dot com
2007-06-18 14:19 ` sunjoong at gmail dot com
2007-06-18 14:20 ` sunjoong at gmail dot com
2007-06-18 15:08 ` [Bug fortran/32391] Generate wrong optimization code from fortran 77 sunjoong at gmail dot com
2007-06-18 15:38 ` [Bug fortran/32391] Generate wrong optimization code on " dominiq at lps dot ens dot fr
2007-06-18 16:07 ` sunjoong at gmail dot com
2007-06-18 16:38 ` [Bug fortran/32391] Wrong code with optimization on i686-pc-linux-gnu burnus at gcc dot gnu dot org
2007-06-18 17:26 ` sunjoong at gmail dot com
2007-06-18 18:31 ` sunjoong at gmail dot com
2007-06-18 18:36 ` kargl at gcc dot gnu dot org
2007-06-18 18:47 ` sunjoong at gmail dot com
2007-06-18 19:16 ` kargl at gcc dot gnu dot org
2007-06-18 20:24 ` sunjoong at gmail dot com
2007-06-18 20:48 ` kargl at gcc dot gnu dot org
2007-06-19  8:11 ` pinskia at gcc dot gnu dot org
2007-06-20 23:34 ` sunjoong at gmail dot com
2007-06-21  2:24 ` kargl at gcc dot gnu dot org
2007-06-21  3:27 ` sunjoong at gmail dot com
2007-06-21  4:08 ` kargl at gcc dot gnu dot org
2007-06-21  4:35 ` sunjoong at gmail dot com
2007-06-21  4:55 ` kargl at gcc dot gnu dot org
2007-06-21  9:15 ` sunjoong at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).