http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46373
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |ASSIGNED AssignedTo|unassigned at gcc dot |jvdelisle at gcc dot |gnu.org |gnu.org --- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-09 13:22:15 UTC --- In Fortran, by definition, "internal unit" is a character string. Libgfortran defines a common I/O interface. During initialization of an I/O call, the appropriate functions are mapped via function pointers so that when the read/write statements are executed, either the external unit (file) routines or internal unit (string) routines are invoked. Regardless, I misunderstood your original post. I will commit the following obvious patch after regression testing. At least the code lived up to its comment. ;) Index: libgfortran/io/transfer.c =================================================================== --- libgfortran/io/transfer.c (revision 166469) +++ libgfortran/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;