This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44698] New: I/O: FLUSH does not actually flush the buffer?
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jun 2010 17:04:49 -0000
- Subject: [Bug fortran/44698] New: I/O: FLUSH does not actually flush the buffer?
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Kai Tietz reported that inquire_size.f90 fails on MinGW as inquire(...
size=size) returns 0 instead of 3000.
Question 1: Why does gfortran always use "stat". Wouldn't it be better to use
for open files:
save = ftell(s)
seek(s, 0, SEEK_END)
size = ftell(s)
seek (s, save, SEEK_SET
Question 2: I fail to see how FLUSH actually works. It seems to work most of
the time, but I probably miss something. I somehow had expected to see a call
to fflush - but I only see this for STDIN/STDOUT/STDERR. For the others, I
find:
raw_flush == return 0;
buf_flush: Some action, including lseek and raw_write (= unistd.h's write)
The function is called via sflush. And the FLUSH statement is file_pos.c's
st_flush:
library_start (&fpp->common);
u = find_unit (fpp->common.unit);
if (u != NULL)
{
if (u->flags.form == FORM_FORMATTED)
fbuf_flush (u, u->mode);
sflush (u->s);
unlock_unit (u);
} [...]
library_end ();
Thus: I fail to see any fflush call for non-std(out/err/in) units. Did I miss
something?
--
Summary: I/O: FLUSH does not actually flush the buffer?
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44698