[Bug libfortran/78833] Misleading IOMSG after failed WRITE(...,POS=) on unconnected formatted stream file

mecej4 at operamail dot com gcc-bugzilla@gcc.gnu.org
Sat Dec 17 12:59:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78833

--- Comment #3 from mecej4 at operamail dot com ---
I understand what happens, and this is not a bug per se', but in normal usage
the message wording can be confusing.

During the second run, the OPEN fails because 'NEW' is specified and the file
already exists.

If the program does not stop when the OPEN failed and goes on to the WRITE, the
unit is not open or connected, so an implicit OPEN is performed to file
'FORT10', with no keyword options in the implicit OPEN. Therefore, the newly
created FORT10 is not a stream file. but a simple formatted sequential file,
and the WRITE fails because it contains a POS= clause. 

These details are not immediately evident when one looks at the WRITE
statement, hence the possibility of confusion. Wording such as "'POS=' clause
in WRITE to sequential formatted file FORT10" would alert the user to what went
wrong and how to resolve the problem.


More information about the Gcc-bugs mailing list