OSDN Git Service

2010-03-11 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Mar 2010 16:06:37 +0000 (16:06 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Mar 2010 16:06:37 +0000 (16:06 +0000)
        PR fortran/43228
        * io/list_read.c (nml_parse_qualifier): Disable expanded_read
        for array sections.

2010-03-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/43228
        * gfortran.dg/namelist_61.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157389 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9a8709a..152db47 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-11  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/43228
+       * gfortran.dg/namelist_61.f90: New test.
+
 2010-03-11  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43255
diff --git a/gcc/testsuite/gfortran.dg/namelist_61.f90 b/gcc/testsuite/gfortran.dg/namelist_61.f90
new file mode 100644 (file)
index 0000000..c7214dd
--- /dev/null
@@ -0,0 +1,35 @@
+! { dg-do run }
+!
+! PR fortran/43228
+!
+integer :: a(3,3)
+character(len=100) :: str
+namelist /nml/a
+
+a = -1
+str = '&nml a(1,:) = 1 2 3 /'
+read(str, nml=nml)
+if (any (a(1,:) /= [1, 2, 3])) call abort ()
+if (any (a([2,3],:) /= -1)) call abort ()
+
+a = -1
+str = '&nml a(1,1) = 1 2 3 4 /'
+read(str, nml=nml)
+if (any (a(:,1) /= [1, 2, 3])) call abort ()
+if (any (a(:,2) /= [4, -1, -1])) call abort ()
+if (any (a(:,3) /= -1)) call abort ()
+
+str = '&nml a(1,:) = 1 2 3 , &
+       &    a(2,:) = 4,5,6 &
+       &    a(3,:) = 7 8 9/'
+read(str, nml=nml)
+if (any (a(1,:) /= [1, 2, 3])) call abort ()
+if (any (a(2,:) /= [4, 5, 6])) call abort ()
+if (any (a(3,:) /= [7, 8, 9])) call abort ()
+
+!print *, a(:,1)
+!print *, a(:,2)
+!print *, a(:,3)
+end
+
+
index e496264..4f59525 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-11  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/43228
+       * io/list_read.c (nml_parse_qualifier): Disable expanded_read
+       for array sections.
+
 2010-03-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/43320
index afd5b45..830cde2 100644 (file)
@@ -2091,6 +2091,14 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
            }
        }
 
+      if (is_array_section == 1 && dtp->u.p.expanded_read == 1)
+       {
+         int i;
+         dtp->u.p.expanded_read = 0;
+         for (i = 0; i < dim; i++)
+           ls[i].end = ls[i].start;
+       }
+
       /* Check the values of the triplet indices.  */
       if ((ls[dim].start > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim]))
           || (ls[dim].start < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim]))