re PR libfortran/17709 (NULL I/O list and Format error.)
authorPaul Brook <paul@codesourcery.com>
Wed, 6 Oct 2004 18:27:58 +0000 (18:27 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Wed, 6 Oct 2004 18:27:58 +0000 (18:27 +0000)
PR libfortran/17709
* io/transfer.c (data_transfer_init): Reset sf_seen_eor.
testsuite/
* gfortran.dg/empty_format_1.f90: New test.

From-SVN: r88615

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

index a244c2aefad3216c89650f1eed91dfc99d7668fb..0ae64e17dfd427ef23cc783c2ad6d076d8b13efc 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-06  Paul Brook  <paul@codesourcery.com>
+
+       PR libfortran/17709
+       * gfortran.dg/empty_format_1.f90: New test.
+
 2004-10-06  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/17568
diff --git a/gcc/testsuite/gfortran.dg/empty_format_1.f90 b/gcc/testsuite/gfortran.dg/empty_format_1.f90
new file mode 100644 (file)
index 0000000..450df6d
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do run }
+! PR 17709
+! We weren't resetting the internal EOR flag correctly, so the second read
+! wasn't advancing to the next line.
+program main
+  integer io_unit
+  character*20 str
+  io_unit = 10
+  open (unit=io_unit,status='scratch',form='formatted')
+  write (io_unit, '(A)'), "Line1"
+  write (io_unit, '(A)'), "Line2"
+  write (io_unit, '(A)'), "Line3"
+  rewind (io_unit)
+  read (io_unit,'(A)') str
+  if (str .ne. "Line1") call abort
+  read (io_unit,'()')
+  read (io_unit,'(A)') str
+  if (str .ne. "Line3") call abort
+  close(unit=io_unit)
+end
+
index 2560d698fb565591623f6798d26a03233826ecac..82b0577dec269b2ad449fba6378bbe411d63e584 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-06  Paul Brook  <paul@codesourcery.com>
+
+       PR libfortran/17709
+       * io/transfer.c (data_transfer_init): Reset sf_seen_eor.
+
 2004-10-04  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * intrinsics/mvbits.c: Commit the file.
index ca920724b0d31f293ad0c41f9dcd35d208433995..70a41fcff8356641dd0d3b11eb53eb004cdb3b3d 100644 (file)
@@ -1074,6 +1074,7 @@ data_transfer_init (int read_flag)
   g.seen_dollar = 0;
   g.first_item = 1;
   g.item_count = 0;
+  sf_seen_eor = 0;
 
   pre_position ();