Consider the following:

! Test reopening with io status='old'
! First create a test file: "touch foo"
program iostatus
  open (1, file='foo', status='old')
  open (1, file='foo', status='old')
end program iostatus

According to the standard (F2003 draft, section 9.4.5, page 181):

"A STATUS= specifier with a value of OLD is always allowed when the file to be
connected to the unit is the same as the file to which the unit is connected."

However, gfortran claims:

At line 5 of file iostatus.f90
Fortran runtime error: Cannot change STATUS parameter in OPEN statement

-- 
           Summary: Reopening file with STATUS='OLD' doesn't work
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jblomqvi at cc dot hut dot fi
                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=24112

Reply via email to