re PR libfortran/18398 (Formatted I/O problems)
authorBud Davis <bdavis9659@comcast.net>
Fri, 7 Jan 2005 03:25:47 +0000 (03:25 +0000)
committerBud Davis <bdavis@gcc.gnu.org>
Fri, 7 Jan 2005 03:25:47 +0000 (03:25 +0000)
2005-01-07  Bud Davis  <bdavis9659@comcast.net>

        PR fortran/18398
        * transfer.c (next_record_r): always skip the
        eol search if it was found during sf_read.

        * gfortran.dg/fmt_read.f90: New test.

From-SVN: r93035

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/fmt_read.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/transfer.c

index bb8bf45d9145ca3ed14c7afe2105be6f9cdb554a..b3ac9e9e0685fb8e24a6759ff1e943cce71a5987 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-07  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/18398
+       * gfortran.dg/fmt_read.f90: New test.
+
 2005-01-06  Geoffrey Keating  <geoffk@apple.com>
 
        * gcc.dg/rs6000-ldouble-2.c: New.
diff --git a/gcc/testsuite/gfortran.dg/fmt_read.f90 b/gcc/testsuite/gfortran.dg/fmt_read.f90
new file mode 100644 (file)
index 0000000..3b33946
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do run }
+! pr18398, missing data on sequential formatted reads
+! test contributed by Thomas.Koenig@online.de
+      open(7,status='scratch')
+      write (7,'(F12.5)') 1.0, 2.0, 3.0
+      rewind(7)
+      read(7,'(F15.5)') a,b
+!   note the read format is wider than the write
+      if (abs(a-1.0) .gt. 1e-5) call abort
+      if (abs(b-2.0) .gt. 1e-5) call abort
+      end
index f416be58eab1b5a05635221bffea256d35735365..805cab133a3c4a76b7303855f60a0483d19e6b71 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-07  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/18398
+       * transfer.c (next_record_r): always skip the
+       eol search if it was found during sf_read.
+
 2004-12-27  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * libgfortran/libgfortran.h (GFC_UINTEGER_1, GFC_UINTEGER_2): 
index fb673042432f5c56caad8a4f2697b7d63b56aa6c..d55110ad30bc0a01dfe718b08a6a22a86b3d03ad 100644 (file)
@@ -1209,7 +1209,8 @@ next_record_r (int done)
 
     case FORMATTED_SEQUENTIAL:
       length = 1;
-      if (sf_seen_eor && done)
+      /* sf_read has already terminated input because of an '\n'  */
+      if (sf_seen_eor) 
          break;
 
       do