------- Comment #3 from fxcoudert at gcc dot gnu dot org 2007-05-07 09:59 ------- Tentative patch:
Index: intrinsics/system.c =================================================================== --- intrinsics/system.c (revision 124460) +++ intrinsics/system.c (working copy) @@ -49,6 +49,9 @@ system_sub (const char *fcmd, GFC_INTEGE char cmd[cmd_len + 1]; int stat; + /* Flush all I/O units before executing the command. */ + flush_all_units(); + memcpy (cmd, fcmd, cmd_len); cmd[cmd_len] = '\0'; Index: libgfortran.h =================================================================== --- libgfortran.h (revision 124460) +++ libgfortran.h (working copy) @@ -658,6 +658,11 @@ internal_proto(fstrcpy); extern void cf_strcpy (char *, int, const char *); internal_proto(cf_strcpy); +/* io/intrinsics.c */ + +extern void flush_all_units (void); +internal_proto(flush_all_units); + /* io.c */ extern void init_units (void); Index: io/io.h =================================================================== --- io/io.h (revision 124460) +++ io/io.h (working copy) @@ -586,9 +586,6 @@ internal_proto(compare_file_filename); extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len); internal_proto(find_file); -extern void flush_all_units (void); -internal_proto(flush_all_units); - extern int stream_at_bof (stream *); internal_proto(stream_at_bof); Are there other similar cases of intrinsics where we'd better FLUSH units before using them. -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu dot | |org Keywords| |patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31607