public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/25340]  New: Runtime error: "Read past ENDFILE record"
@ 2005-12-10 16:33 fxcoudert at gcc dot gnu dot org
  2005-12-10 16:55 ` [Bug libfortran/25340] " kargl at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-10 16:33 UTC (permalink / raw)
  To: gcc-bugs

PR 25139 is in fact two different bugs, so I open this PR to separate them.

$ cat a.f90
  integer :: i = 1
  open(11,status="replace",form="unformatted")
  read(11,end=1008) i
1008 continue
  read(11,end=1011) i
1011 continue
  end
$ gfortran a.f90 && ./a.out
At line 5 of file a.f90
Fortran runtime error: Read past ENDFILE record


-- 
           Summary: Runtime error: "Read past ENDFILE record"
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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


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

* [Bug libfortran/25340] Runtime error: "Read past ENDFILE record"
  2005-12-10 16:33 [Bug libfortran/25340] New: Runtime error: "Read past ENDFILE record" fxcoudert at gcc dot gnu dot org
@ 2005-12-10 16:55 ` kargl at gcc dot gnu dot org
  2005-12-11 10:52 ` fxcoudert at gcc dot gnu dot org
  2006-02-04  8:36 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2005-12-10 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2005-12-10 16:55 -------
What is the bug?

9.4.1.6   End-of-file branch
If an end-of-file condition (9.4.3) occurs and no error condition (9.4.3)
occurs during execution of an input statement that contains an END= specifier
      (1)   Execution of the input statement terminates,
      (2)   If the file specified in the input statement is an external file,
it
            is positioned after the endfile record.

So, after the first read(11,end=1008), the file is positioned "after the
endfile
record."  Your second read(11,end=1011) is reading past the ENDFILE record, 
which is what the runtime error says.

Now, if your second read statement had been read(11,err=1011), then everything
should work out.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


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


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

* [Bug libfortran/25340] Runtime error: "Read past ENDFILE record"
  2005-12-10 16:33 [Bug libfortran/25340] New: Runtime error: "Read past ENDFILE record" fxcoudert at gcc dot gnu dot org
  2005-12-10 16:55 ` [Bug libfortran/25340] " kargl at gcc dot gnu dot org
@ 2005-12-11 10:52 ` fxcoudert at gcc dot gnu dot org
  2006-02-04  8:36 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-11 10:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2005-12-11 10:52 -------
So, following Steven's question on c.l.f, this code is illegal.

Most compilers report an EOF error (including Intel and g77), and branch if an
END tag is present. I think the error issued by gfortran currently is better
("Read past ENDFILE record"), ie more precise.

If people provide an END tag in the I/O statement, what do we want to do? I am
in favour of throwing an error, and not branching silently. I know (from c.l.f)
Brook thinks the same. I think we can close this as INVALID if you agree,
Steven.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug libfortran/25340] Runtime error: "Read past ENDFILE record"
  2005-12-10 16:33 [Bug libfortran/25340] New: Runtime error: "Read past ENDFILE record" fxcoudert at gcc dot gnu dot org
  2005-12-10 16:55 ` [Bug libfortran/25340] " kargl at gcc dot gnu dot org
  2005-12-11 10:52 ` fxcoudert at gcc dot gnu dot org
@ 2006-02-04  8:36 ` fxcoudert at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-04  8:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2006-02-04 08:36 -------
Well, I'm closing this one as invalid. Steve, if you disagree, feel free to
reopen it.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-02-04  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-10 16:33 [Bug libfortran/25340] New: Runtime error: "Read past ENDFILE record" fxcoudert at gcc dot gnu dot org
2005-12-10 16:55 ` [Bug libfortran/25340] " kargl at gcc dot gnu dot org
2005-12-11 10:52 ` fxcoudert at gcc dot gnu dot org
2006-02-04  8:36 ` fxcoudert 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).