This is the mail archive of the mailing list for the GCC 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: [patch, libgfortran] PR46733 fflush called when reading from a string

On 11/09/2010 10:37 AM, Janne Blomqvist wrote:
On Tue, Nov 9, 2010 at 15:54, Jerry DeLisle<> wrote:
Committed as obvious.

Sending        ChangeLog
Sending        io/transfer.c
Transmitting file data ..
Committed revision 166490.

Index: io/transfer.c =================================================================== --- io/transfer.c (revision 166469) +++ io/transfer.c (working copy) @@ -2646,7 +2646,8 @@ }

   /* Bugware for badly written mixed C-Fortran I/O.  */
-  flush_if_preconnected(dtp->u.p.current_unit->s);
+  if (!is_internal_unit (dtp))
+    flush_if_preconnected(dtp->u.p.current_unit->s);

dtp->u.p.current_unit->mode = dtp->u.p.mode;

Thanks for fixing this bug.

Generally though, I think this flush_if_preconnected() function should
be removed. Either we

1) Never buffer the preconnected units (or, we have mandatory line
buffering via the use of fbuf.h, but no more than that), in which case
we should remove GFORTRAN_UNBUFFERED_PRECONNECTED and modify the
checks in unix.c:fd_to_stream() such that we always call raw_init()
for preconnected units. This would be practically equivalent to the
status quo.

2) Potentially buffer preconnected units if they are redirected
to/from a regular file, and tell users to use GFORTRAN_UNBUFFERED_ALL
if they wish to prevent said buffering.

In neither of the above cases is flush_if_preconnected() needed. Any
opinions on which approach is preferred?

I agree we should get rid of it. I am leaning a bit toward 1) above. Do you think we should wait until after 4.6 release? After 4.6 release we plan to break ABI in a lot of places and this little tweak would be insignificant. (Of course by itself it does not break ABI)


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