]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR libfortran/20930 (gfortran.dg/backspace.f execution test)
authorDavid Edelsohn <edelsohn@gnu.org>
Sat, 11 Jun 2005 20:21:40 +0000 (20:21 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Sat, 11 Jun 2005 20:21:40 +0000 (16:21 -0400)
        Backport from mainline:
        PR libfortran/20930
        * io/rewind.c (st_rewind): Flush the stream when resetting the mode
        from WRITING to READING.

From-SVN: r100844

libgfortran/ChangeLog
libgfortran/io/rewind.c

index d28e2c1767a275d2c8de37bf55dabe77bd4dfd3b..838b1a87503bde81120fe8e80b005cbfabd8576b 100644 (file)
@@ -1,3 +1,10 @@
+2005-06-11  David Edelsohn  <edelsohn@gnu.org>
+
+       Backport from mainline:
+       PR libfortran/20930
+       * io/rewind.c (st_rewind): Flush the stream when resetting the mode
+       from WRITING to READING.
+
 2005-06-05  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from the mainline:
index f0b0e90e45449fddb9e003b94d0b7e8b2ad4e74e..48d57bafaa53a719694e3e7f6253466e49f5e6f5 100644 (file)
@@ -54,9 +54,13 @@ st_rewind (void)
          /* If we have been writing to the file, the last written record
             is the last record in the file, so truncate the file now.
             Reset to read mode so two consecutive rewind statements
-            don't delete the file contents.  */
-          if (u->mode==WRITING)
-            struncate(u->s);
+            don't delete the file contents.  Flush buffer when switching
+            mode.  */
+          if (u->mode == WRITING)
+           {
+             flush (u->s);
+             struncate (u->s);
+           }
          u->mode = READING;
          u->last_record = 0;
          if (sseek (u->s, 0) == FAILURE)