]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/39528 (repeated entries are not read when using list-directed input)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 4 Apr 2009 19:04:53 +0000 (19:04 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 4 Apr 2009 19:04:53 +0000 (19:04 +0000)
2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/39528
* gfortran.dg/read_repeat.f90: New test.

2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/39528
Backport from trunk.
* io/list_read.c (list_formatted_read_scalar): Move check for read
completion to just after the check for a repeated value.

From-SVN: r145548

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/read_repeat.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/list_read.c

index 890ac47d339c490a4b9e509a2f3cdafa6696c1bd..4f93fa4eab01b9057b933ed0153b1ca232d97d0f 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/39528
+       * gfortran.dg/read_repeat.f90: New test.
+
 2009-04-04  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/39519
diff --git a/gcc/testsuite/gfortran.dg/read_repeat.f90 b/gcc/testsuite/gfortran.dg/read_repeat.f90
new file mode 100644 (file)
index 0000000..192ebe8
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do run }
+! PR39528 repeated entries not read when using list-directed input.
+! Test case derived from reporters example.
+program rread
+  implicit none
+  integer :: iarr(1:7), ia, ib, i
+
+  iarr = 0
+  
+  write(10,*) " 2*1  3*2 /"
+  write(10,*) " 12"
+  write(10,*) " 13"
+  rewind(10)
+
+  read(10,*) (iarr(i), i=1,7)
+  read(10,*) ia, ib
+
+  if (any(iarr(1:2).ne.1)) call abort
+  if (any(iarr(3:5).ne.2)) call abort
+  if (any(iarr(6:7).ne.0)) call abort
+  if (ia .ne. 12 .or. ib .ne. 13) call abort
+  
+  close(10, status="delete")
+end program rread
index 452b168bd2e1d29320f0e6870c86c6e9d9593161..29b18925bbc5f4dee64b1c57d0fecbbfb98f01f1 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/39528
+       Backport from trunk.
+       * io/list_read.c (list_formatted_read_scalar): Move check for read
+       completion to just after the check for a repeated value.
+
 2009-01-24  Release Manager
 
        * GCC 4.3.3 released.
index 2375432fae970d348e2bce035a03ad2e12fc6a1d..367caeaf3946c08d237704158ef3c9bc1d7e4f4d 100644 (file)
@@ -1712,9 +1712,6 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, int kind,
     }
   else
     {
-      if (dtp->u.p.input_complete)
-       goto cleanup;
-
       if (dtp->u.p.repeat_count > 0)
        {
          if (check_type (dtp, type, kind))
@@ -1722,6 +1719,9 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, int kind,
          goto set_value;
        }
 
+      if (dtp->u.p.input_complete)
+       goto cleanup;
+
       if (dtp->u.p.at_eol)
        finish_separator (dtp);
       else