diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb8bf45d9145..b3ac9e9e0685 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-01-07 Bud Davis + + PR fortran/18398 + * gfortran.dg/fmt_read.f90: New test. + 2005-01-06 Geoffrey Keating * 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 index 000000000000..3b33946a5231 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/fmt_read.f90 @@ -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 diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f416be58eab1..805cab133a3c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2005-01-07 Bud Davis + + 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 * libgfortran/libgfortran.h (GFC_UINTEGER_1, GFC_UINTEGER_2): diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index fb673042432f..d55110ad30bc 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -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