public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44477]  New: Sequential I/O with END FILE: File position should be at EoF
@ 2010-06-09  8:13 burnus at gcc dot gnu dot org
  2010-06-09 19:24 ` [Bug fortran/44477] " jvdelisle at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-09  8:13 UTC (permalink / raw)
  To: gcc-bugs

Based on
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/cfb5f9dca46d5114#

After ENDFILE for non-streams, the current file position should be at the
endfile record. Thus, running the program below with NAG gives:
  READ/WRITE attempted after ENDFILE on unit 10
  Program terminated by I/O error on unit 10 (File="XXX",Formatted,Sequential)

And with Pathf95:
  A WRITE operation is invalid if the file is positioned after the end-of-file.

While with gfortran it simply runs. (Ditto for g95 and ifort.) [One could
continue to do so as extension, but one should do so knowingly.]


F2008: "9.8.3 ENDFILE statement"

"Execution of an ENDFILE statement for a file connected for sequential access
writes an endfile record as the next record of the file. The file is then
positioned after the end file record, which becomes the last record of the 
file. If the file also may be connected for direct access, only those records
before the endfile record are considered to have been written. Thus, only those
records may be read during subsequent direct access connections to the \ffile.
   After execution of an ENDFILE statement for a file connected for sequential
access, a BACKSPACE or REWIND statement shall be used to reposition the \ffile
prior to execution of any data transfer input/output statement or ENDFILE
statement.
   Execution of an ENDFILE statement for a \ffile connected for stream access
causes the terminal point of the \ffile to become equal to the current file
position. Only file storage units before the current position are considered to
have been written; thus only those \ffile storage units may be subsequently
read. Subsequent stream output statements may be used to write further data to
the file.
   Execution of an ENDFILE statement for a file that is connected but does not
exist creates the file; if the \ffile is connected for sequential access, it is
created prior to writing the endfile record."


!-------------------------------------------
       OPEN(10, FILE='XXX', FORM='FORMATTED', &
                 ACTION='WRITE', POSITION='REWIND')
        ENDFILE(10)
      write(10,*) 'aa'
end


-- 
           Summary: Sequential I/O with END FILE: File position should be at
                    EoF
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

end of thread, other threads:[~2010-06-23  2:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-09  8:13 [Bug fortran/44477] New: Sequential I/O with END FILE: File position should be at EoF burnus at gcc dot gnu dot org
2010-06-09 19:24 ` [Bug fortran/44477] " jvdelisle at gcc dot gnu dot org
2010-06-09 19:41 ` burnus at gcc dot gnu dot org
2010-06-11 16:27 ` burnus at gcc dot gnu dot org
2010-06-12 22:33 ` jvdelisle at gcc dot gnu dot org
2010-06-19  0:58 ` jvdelisle at gcc dot gnu dot org
2010-06-19  1:05 ` jvdelisle at gcc dot gnu dot org
2010-06-20 16:15 ` michael dot a dot richmond at nasa dot gov
2010-06-20 16:41 ` kargl at gcc dot gnu dot org
2010-06-20 19:58 ` jvdelisle at gcc dot gnu dot org
2010-06-22 11:56 ` michael dot a dot richmond at nasa dot gov
2010-06-22 13:01 ` burnus at gcc dot gnu dot org
2010-06-22 13:02 ` michael dot a dot richmond at nasa dot gov
2010-06-23  2:37 ` jvdelisle at gcc dot gnu dot org
2010-06-23  2:38 ` jvdelisle at gcc dot gnu dot 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).