re PR fortran/47778 (reading two arrays of structures from namelist fails)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 27 Feb 2011 20:08:44 +0000 (20:08 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 27 Feb 2011 20:08:44 +0000 (20:08 +0000)
2011-02-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/47778
* gfortran.dg/namelist_71.f90: New test.

From-SVN: r170549

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_71.f90 [new file with mode: 0644]

index 91994091bc5e049fd0d135bcc2dcd4004d9553fe..e9a44cda21c70e02de2178a1e5bca8e75397cea5 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/47778
+       * gfortran.dg/namelist_71.f90: New test.
+
 2011-02-27  Jason Merrill  <jason@redhat.com>
 
        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 (file)
index 0000000..c0428d9
--- /dev/null
@@ -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
+