re PR libfortran/31607 (CALL SYSTEM produces garbled output when writing to a buffere...
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Mon, 7 May 2007 19:48:40 +0000 (19:48 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Mon, 7 May 2007 19:48:40 +0000 (19:48 +0000)
PR libfortran/31607
* intrinsics/system.c (system_sub): Call flush_all_units.
* io/io.h (flush_all_units): Move prototype to libgfortran.h.
* libgfortran.h (flush_all_units): Add prototype.

From-SVN: r124510

libgfortran/ChangeLog
libgfortran/intrinsics/system.c
libgfortran/io/io.h
libgfortran/libgfortran.h

index 24cf9297d8a1b8c8ba58d6724e93859de5821da6..18118d887995424265b986472ad1f43a1bd302db 100644 (file)
@@ -1,3 +1,10 @@
+2007-05-07  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR libfortran/31607
+       * intrinsics/system.c (system_sub): Call flush_all_units.
+       * io/io.h (flush_all_units): Move prototype to libgfortran.h.
+       * libgfortran.h (flush_all_units): Add prototype.
+
 2007-05-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/31201
index 73f937142f650b17c3ef1270fa8f8eae0317a12d..49a5ba2a6d5f412c7bf3f7daab85f4475a2e6ba5 100644 (file)
@@ -49,6 +49,9 @@ system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len)
   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 181c1816b61709999c8227ef5cbcd52348b06954..a1138cffac060b6b68379b97304d5bb929222b0a 100644 (file)
@@ -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);
 
index bfbfbef634d836c0bee455f2345d6e0ac5778935..0f7d2c7705a818c9250a8ee960d01761372a8587 100644 (file)
@@ -666,6 +666,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);