This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/59513] [4.8/4.9/4.10 Regression] Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59513

--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Reduced test

      CHARACTER*29 LINE1, LINE2
      CHARACTER*128 LINEL, LINED, LINEF, FNPOL
      INTEGER :: i, IA, IA1, IA2, NBL, NIPOL, NJPOL, LU
      INTEGER :: IRETYP = 1, IMATYP = 1
      INTEGER :: IPOL(6) = [(i,i=1,6)], JPOL(6) = [(i,i=1,6)]
      REAL :: CPOL(2,6), CPOLSD(2,4,6)

      IA1 = 1
      IA2 = 1
      NBL = 1
      NIPOL = 5
      NJPOL = 1
      CPOL = 0.0
      CPOL(1,1:5) = [0.00000000, -1.12720882E-05, 7.72975758E-03,      &
                     2.23584706E-03, 2.04495814E-06]
      CPOLSD = 0.0
      CPOLSD(1,1,1) = 0.591679573
      CPOLSD(1,2,1) = 0.591711044

      FNPOL = 'xfoil.res'
      LINEF = '(1X,F7.3  ,F9.4  ,F10.5 ,F10.5 ,F9.4  ,F9.4  ,F9.4  )'
      OPEN(LU,FILE=FNPOL,STATUS='UNKNOWN')
      CALL BOTTOM(LU)

      do 40 IA = IA1, IA2
        WRITE(LU,LINEF) (CPOL(IA,IPOL(KP)), KP=1, NIPOL),             &
             ((CPOLSD(IA,IS,JPOL(KP)), IS=1, 2*NBL), KP=1, NJPOL)
   40 CONTINUE

      CLOSE(LU)

      END

      SUBROUTINE BOTTOM(LU)
      CHARACTER*1 DUMMY

 10   READ(LU,1000,END=90,ERR=90) DUMMY
 1000 FORMAT(A)
      GO TO 10

 90   RETURN
      END

The 'culprit' is the line

CALL BOTTOM(LU)

The code works with gcc 4.5.0 r157963, but not with gcc 4.8.3.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]