The end of file is not correctly positioned by gfortran after this program
writes, closes and reopens a binary file (It works Ok with fort77) -

[dranta:~/tests/gfortran-D] dir% fort77 -o write27 write27.f
** test   === End of Compilation 1 ===
1501-510  Compilation successful for file write27.f.
[dranta:~/tests/gfortran-D] dir% write27
[dranta:~/tests/gfortran-D] dir% gfortran -o write27 write27.f
[dranta:~/tests/gfortran-D] dir% write27
  eof at wrong location            4           3
Abort
[dranta:~/tests/gfortran-D] dir% cat write27.f
      program test
      integer at,eof
      dimension idata(1011)
      open(unit=11,form='unformatted')
       write(11)idata
       write(11)idata
       write(11)idata
       backspace 11
       backspace 11
       write(11)idata
      close(11,status='keep')  
      eof=3
      open(unit=11,form='unformatted')
      rewind 11
      do at=1,eof+1
        iat=at
        read(11,end=250)idata
      enddo 
      write(6,*)' eof not read ',iat,eof 
      call abort()
      goto 300
 250  continue
      if(iat.ne.eof)then
        write(6,*)' eof at wrong location ',iat,eof 
        call abort     
      endif
 300  continue
      close(11,status='delete')  
      stop
      end

[dranta:~/tests/gfortran-D] dir% gfortran --v
Using built-in specs.
Target: powerpc-apple-darwin8.5.0
Configured with: ../gcc/configure --prefix=/Users/dir/gfortran
--enable-languages=c,f95
Thread model: posix
gcc version 4.2.0 20060228 (experimental)


-- 
           Summary: gfortran - End of File incorrectly positioned after
                    binary I/O.
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dir at lanl dot gov
  GCC host triplet: powerpc-apple-darwin8.5.0


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

Reply via email to