------- Comment #11 from burnus at gcc dot gnu dot org  2010-06-22 13:01 -------
(In reply to comment #10)
> (In reply to comment #9)
> > Michael, is this a legacy code issue? two ENDFILE in a row?
> It is legacy code

Any idea how to best deal with this?

The standard is pretty clear that it is invalid (cf. comment 0 and comment 8) -
though the standard is pretty weak about what a conforming "processor" (i.e.
compiler + run-time library) shall do for I/O, thus, there is some freedom.

For the example in comment 0, several compilers print a run-time error:
  NAG f95 v5.1, Pathscale pathf95 3.2.99, Cray ftn 8.2.3, Open64 4.2, gfortran
4.6

If there has been no file access (write/read/open/rewind) before the first,
ENDFILE, the second ENDFILE succeeds with crayftn, openf95, and pathf95. (NAG
has the bogus error that the file is not open.) While (cf. comment 6) with
gfortran there is an error for the second endfile.

For the legacy program, would it be enough to allow - similarly to
Cray/Open64/Pathscale - two ENDFILEs on unopened files? Or do you also use
other endfile/endfile combinations? (If so, the program should also fail
Cray/Open64/Pathscale/NAG.)


-- 


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

Reply via email to