]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/60810 (list directed io from array results in end of file)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 12 Apr 2014 22:52:10 +0000 (22:52 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 12 Apr 2014 22:52:10 +0000 (22:52 +0000)
2014-04-12  Jerry DeLisle  <jvdelisle@gcc.gnu>

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
gcc/testsuite/gfortran.dg/arrayio_13.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/unit.c

index e7381a2288cf35efa1285aa56abb271061a22c89..81da383357b4367425fc841523196b2149775535 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-12  Jerry DeLisle  <jvdelisle@gcc.gnu>
+
+       Backport from mainline
+       PR libfortran/60810
+       gfortran.dg/arrayio_13.f90: New test.
+
 2014-04-11  Hans-Peter Nilsson  <hp@axis.com>
 
        * 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 (file)
index 0000000..92a856b
--- /dev/null
@@ -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
index 7bc178b2d01eec763d26545cf8d7c2e1e477a9c5..9eb18d4d6a3eef13560432323e6919a4816d4945 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-12  Jerry DeLisle  <jvdelisle@gcc.gnu>
+
+       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  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline
index ab61769a2eb16b006e25432a0415c16f3fe0f007..d1b1a712ed2a676870c910e5856395344a5b74c5 100644 (file)
@@ -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)