From: Jerry DeLisle Date: Sun, 27 Feb 2011 20:08:44 +0000 (+0000) Subject: re PR fortran/47778 (reading two arrays of structures from namelist fails) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c3ea2c417f14ab7311502624df171360f4d81109;p=gcc.git re PR fortran/47778 (reading two arrays of structures from namelist fails) 2011-02-27 Jerry DeLisle PR libgfortran/47778 * gfortran.dg/namelist_71.f90: New test. From-SVN: r170549 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91994091bc5..e9a44cda21c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-27 Jerry DeLisle + + PR libgfortran/47778 + * gfortran.dg/namelist_71.f90: New test. + 2011-02-27 Jason Merrill PR c++/47906 diff --git a/gcc/testsuite/gfortran.dg/namelist_71.f90 b/gcc/testsuite/gfortran.dg/namelist_71.f90 new file mode 100644 index 00000000000..c0428d905b9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_71.f90 @@ -0,0 +1,36 @@ +! { dg-do run } +! PR47778 Reading array of structures from namelist +! Test case derived from the reporters test case. +program test_nml +type field_descr + integer number +end type +type fsetup + type (field_descr), dimension(3) :: vel ! 3 velocity components + type (field_descr), dimension(3) :: scal ! 3 scalars +end type +type (fsetup) field_setup +namelist /nl_setup/ field_setup +field_setup%vel%number = 0 +field_setup%scal%number = 0 +! write(*,nml=nl_setup) +open(10, status="scratch") +write(10,'(a)') "&nl_setup" +write(10,'(a)') " field_setup%vel(1)%number= 3," +write(10,'(a)') " field_setup%vel(2)%number= 9," +write(10,'(a)') " field_setup%vel(3)%number= 27," +write(10,'(a)') " field_setup%scal(1)%number= 2," +write(10,'(a)') " field_setup%scal(2)%number= 4," +write(10,'(a)') " field_setup%scal(3)%number= 8," +write(10,'(a)') "/" +rewind(10) +read(10,nml=nl_setup) +if (field_setup%vel(1)%number .ne. 3) call abort +if (field_setup%vel(2)%number .ne. 9) call abort +if (field_setup%vel(3)%number .ne. 27) call abort +if (field_setup%scal(1)%number .ne. 2) call abort +if (field_setup%scal(2)%number .ne. 4) call abort +if (field_setup%scal(3)%number .ne. 8) call abort +!write(*,nml=nl_setup) +end program test_nml +