re PR fortran/43228 (NAMELIST I/O: Reading at 2 dimensions (rank) array values.)

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-11  Tobias Burnus  <burnus@net-b.de>

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

From-SVN: r157391
This commit is contained in:
Tobias Burnus 2010-03-11 20:48:11 +01:00 committed by Tobias Burnus
parent cdd16cd5ec
commit 4cc74feaf8
4 changed files with 54 additions and 0 deletions

View 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 Janis Johnson <janis187@us.ibm.com>
* lib/target-supports-dg.exp (check-flags): Provide defaults for

View File

@ -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

View 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-02-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/42901

View File

@ -2092,6 +2092,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)ad[dim].ubound)
|| (ls[dim].start < (ssize_t)ad[dim].lbound)