From 924d4906d6dbc4109cc0440e49b701eb6647bd2a Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 12 Apr 2014 22:52:10 +0000 Subject: [PATCH] backport: re PR fortran/60810 (list directed io from array results in end of file) 2014-04-12 Jerry DeLisle Backport from mainline PR libfortran/60810 io/unit.c (is_trim_ok): If internal unit is array, do not trim. Backport from mainline PR libfortran/60810 gfortran.dg/arrayio_13.f90: New test. From-SVN: r209340 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/arrayio_13.f90 | 14 ++++++++++++++ libgfortran/ChangeLog | 6 ++++++ libgfortran/io/unit.c | 4 +--- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/arrayio_13.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7381a2288cf..81da383357b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-04-12 Jerry DeLisle + + Backport from mainline + PR libfortran/60810 + gfortran.dg/arrayio_13.f90: New test. + 2014-04-11 Hans-Peter Nilsson * gfortran.dg/fmt_en.f90: Gate test on effective_target diff --git a/gcc/testsuite/gfortran.dg/arrayio_13.f90 b/gcc/testsuite/gfortran.dg/arrayio_13.f90 new file mode 100644 index 000000000000..92a856bc869d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/arrayio_13.f90 @@ -0,0 +1,14 @@ +! { dg-do run } +! PR60810 Bogus end-of-file +program readstrlist + character(len=80), dimension(2) :: ver + integer :: a, b, c + a = 1 + b = 2 + c = 3 + ver(1) = '285 383' + ver(2) = '985' + read( ver, *) a, b, c + if (a /= 285 .or. b /= 383 .or. c /= 985) call abort + !write ( *, *) a, b, c +end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 7bc178b2d01e..9eb18d4d6a3e 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2014-04-12 Jerry DeLisle + + Backport from mainline + PR libfortran/60810 + io/unit.c (is_trim_ok): If internal unit is array, do not trim. + 2014-04-04 Bill Schmidt Backport from mainline diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index ab61769a2eb1..d1b1a712ed2a 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -383,9 +383,7 @@ static bool is_trim_ok (st_parameter_dt *dtp) { /* Check rank and stride. */ - if (dtp->internal_unit_desc - && (GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc) > 1 - || GFC_DESCRIPTOR_STRIDE(dtp->internal_unit_desc, 0) != 1)) + if (dtp->internal_unit_desc) return false; /* Format strings can not have 'BZ' or '/'. */ if (dtp->common.flags & IOPARM_DT_HAS_FORMAT) -- 2.47.2