The existing testcase gfortran.dg/pr16597.f90 leaves behind a file named
fort.99 and should not do so. (If you run the entire testsuite, you have to
run the testcase manually to see fort.99 because later tests reuse the same
filename and delete it.)
Looking at the code, the last time the file is opened, it uses STATUS='scratch'
so in theory the file should be deleted. Adding status='delete' to the last
close statement has no effect.
! { dg-do run }
! pr 16597
! libgfortran
! reading a direct access record after it was written did
! not always return the correct data.
program gfbug4
implicit none
integer strlen
parameter (strlen = 4)
integer iunit
character string *4
iunit = 99
open (UNIT=iunit,FORM='unformatted',ACCESS='direct',RECL=strlen)
write (iunit, rec=1) 'ABCD'
read (iunit, rec=1) string
close (iunit)
if (string.ne.'ABCD') call abort
open
(UNIT=iunit,FORM='unformatted',ACCESS='direct',STATUS='scratch',RECL=strlen)
write (iunit, rec=1) 'ABCD'
read (iunit, rec=1) string
close (iunit)
if (string.ne.'ABCD') call abort
end
--
Summary: gfortran.dg/pr16597.f90 leaves behind a file
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ghazi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26802