public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52860] New: I/O: gfortran rejects writing after hitting END=
@ 2012-04-04  7:51 burnus at gcc dot gnu.org
  2012-04-05  8:27 ` [Bug fortran/52860] " burnus at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-04  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52860
           Summary: I/O: gfortran rejects writing after hitting END=
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Reported by Christian Convey at
http://gcc.gnu.org/ml/fortran/2012-03/msg00138.html

Note: I have not checked the standard whether the following program is valid, I
just want to make sure that the email does not get lost. Please also answer the
original reporter.


The following program reads from an empty file (created through the open
statement) - it immediately hits an END - and then tries to write to that file.

That succeeds with:
  g77, g95, gfortran <= 4.4, pgf90, ifort

It fails with:
  gfortran >= 4.5, openf95, pathf95, crayftn
with the message:
  Fortran runtime error: Sequential READ or WRITE not allowed after EOF
  marker, possibly use REWIND or BACKSPACE

Please check whether that's indeed the proper error. (If so, should we add some
legacy support?)


      PROGRAM MYTEST
       OPEN( UNIT=3, FILE='FOO', STATUS='UNKNOWN',
     1       FORM='FORMATTED', ACCESS='SEQUENTIAL', IOSTAT=IOS )
       write (*,*) 'reading'
       READ ( UNIT=3, FMT=*, END=10 )  BFR
       write (*,*) 'Done readin (no END)'
       GO TO 20
!    10  REWIND( UNIT=3 )
   10  write (*,*) 'Hit END - writing'
       WRITE( UNIT=3, FMT='(A16)' )  'BATCH MODE = OFF'
       write (*,*) 'Done writing'
   20  write (*,*) 'Really done - closing'
       CLOSE( UNIT=3 )
       END PROGRAM


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/52860] I/O: gfortran rejects writing after hitting END=
  2012-04-04  7:51 [Bug fortran/52860] New: I/O: gfortran rejects writing after hitting END= burnus at gcc dot gnu.org
@ 2012-04-05  8:27 ` burnus at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-05  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-05 08:26:57 UTC ---
Close as INVALID.

>From Fortran 2008, "9.11.3 End-of-file condition and the END= specifier":

"If an end-of-file condition occurs during execution of an input/output
statement that contains either an END= specifier or an IOSTAT= specifier, and
an error condition does not occur then:
...
(4) if the file specified in the input statement is an external record file, it
is positioned after the endfile record;"

And: "9.3.4.3 File position prior to data transfer"

"If the file contains an endfile record, the file shall not be positioned after
the endfile record prior to data transfer. However, a REWIND or BACKSPACE
statement may be used to reposition the file."

(Side note: FORTRAN 77 has nearly same words.)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-05  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  7:51 [Bug fortran/52860] New: I/O: gfortran rejects writing after hitting END= burnus at gcc dot gnu.org
2012-04-05  8:27 ` [Bug fortran/52860] " burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).