$ gfortran -v
Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/ig25 
--enable-languages=c,f95,c++
Thread model: posix
gcc version 4.0.0 20041107 (experimental)
$ cat endfile.f90
program main
  implicit none
  integer :: i,j

  open(unit=10, file='test.dat', access='sequential', status='replace')
  do i=1, 20
     write (10,'(I4)') i
  end do
  rewind(10)
  do i=1,10
     read (10,'(I4)') j
  end do
  endfile(10)
  close(10)
end program main
$ gfortran -o endfile endfile.f90
$ ./endfile
$ cat test.dat
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
$
I may be missing some subtle point the Fortran standard here. but I think the
file should be truncated at 10.

-- 
           Summary: endfile does not truncate file
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to