From 28a7800c05d23408779907b7880adeea36f86af4 Mon Sep 17 00:00:00 2001 From: pbrook Date: Wed, 6 Oct 2004 18:27:58 +0000 Subject: PR libfortran/17709 * io/transfer.c (data_transfer_init): Reset sf_seen_eor. testsuite/ * gfortran.dg/empty_format_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88615 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/empty_format_1.f90 | 21 +++++++++++++++++++++ libgfortran/ChangeLog | 5 +++++ libgfortran/io/transfer.c | 1 + 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/empty_format_1.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a244c2aefad..0ae64e17dfd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-10-06 Paul Brook + + PR libfortran/17709 + * gfortran.dg/empty_format_1.f90: New test. + 2004-10-06 Tobias Schlueter 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 index 00000000000..450df6d171c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/empty_format_1.f90 @@ -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 + diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 2560d698fb5..82b0577dec2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-10-06 Paul Brook + + PR libfortran/17709 + * io/transfer.c (data_transfer_init): Reset sf_seen_eor. + 2004-10-04 Andrew Pinski * intrinsics/mvbits.c: Commit the file. diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index ca920724b0d..70a41fcff83 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -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 (); -- cgit v1.2.1