This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Buffered/unbuffered I/O issues


Harald,

Harald Anlauf wrote:
> is the FLUSH statement supposed to work on stdout?
> IBM's xlf 9.1 stops the execution on encountering a FLUSH(6):
> 1525-201 The FLUSH statement refers to unit 6 which is connected to a non-seekable device.  The FLUSH statement cannot be applied to non-seekable files.  The program will stop.
>   
I don't find anything in the standard ("9.8 FLUSH statement"), which
disallows FLUSH in this case.

"Execution of a FLUSH statement for a file that is connected but does
not exist is permitted and has no effect on any file. A FLUSH statement
has no effect on file position."

Giving this sentence, I also do not see any reason why to reject
non-seekable devices. It also seems to be one of these functions, which
should almost ever succeed even by doing nothing. (Still, there is
iostat=, iomsg= and err= which indicates that this command may fail.)

"Execution of a FLUSH statement causes data written to an external file
to be available to other processes, or causes data placed in an external
file by means other than Fortran to be available to a READ statement.
The action is processor dependent."

The last word allows that FLUSH may always fail for STDOUT; I think
strictly speaking, xlf does not violate the standard, but I would argue
that it is still a bug and I think it that the behaviour is against the
intent of those who standardized FLUSH, but I might be wrong as I was
not there when it was standardized.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]