[Bug fortran/65684] Wrong error message when writing to a string
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 7 16:24:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65684
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
Your program is non-conforming. Technically, gfortran can
do anything. This includes not issuing any error message,
starting World War III, or issuing an error message. In fact,
gfortran's error message is correct to extent that the write
statement reaches the end-of-record.
If one takes the time to wander through the final committee
draft of the Fortran 2008 standard, then one can piece together
the story. The crucial text is the third bullet under Sec. 9.4.
9.2 Records
9.2.1 General
A record is a sequence of values or a sequence of characters.
9.4 Internal files
An internal file is a record file with the following properties.
* A record of an internal file is a scalar character variable.
* If the file is a scalar character variable, it consists of a
single record whose length is the same as the length of the
scalar character variable.
* A record of the internal file becomes defined by writing the
record. If the number of characters written in a record is
less than the length of the record, the remaining portion of
the record is filled with blanks. The number of characters
to be written shall not exceed the length of the record.
9.6.4 Execution of a data transfer input/output statement
9.6.4.1 General
....
(7) Determine whether an error, end-of-file, or end-of-record
condition has occurred.
....
(10) If an error, end-of-file, or end-of-record condition occurred,
processing continues as specified in 9.11; otherwise any
variable specified in an IOSTAT= specifier is assigned the
value zero.
9.11.4 End-of-record condition and the EOR= specifier
If an end-of-record condition occurs during execution of an
input/output statement that contains neither an EOR= specifier
nor an IOSTAT= specifier, error termination is initiated.
IMNSHO, this bug report should be closed as WONTFIX, but I'll
leave it open until others have a chance to comment.
More information about the Gcc-bugs
mailing list