From: Jerry DeLisle Date: Sun, 13 Apr 2014 02:05:02 +0000 (+0000) Subject: backport: re PR fortran/60810 (list directed io from array results in end of file) X-Git-Tag: releases/gcc-4.7.4~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b399bac96f783a5593afd5ba329be41dca417f;p=thirdparty%2Fgcc.git 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 gfortran.dg/arrayio_13.f90: New test. PR libfortran/60810 io/unit.c (is_trim_ok): If internal unit is array, do not trim. From-SVN: r209345 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8b525c08ebe..25cda77f56fe 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-07 Martin Jambor PR ipa/60640 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 7d6fd05ee024..dde1b58f69c3 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-03-15 Jerry DeLisle Backport from mainline diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index d71593b19466..27ee051c8e94 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -385,9 +385,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)