2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_60.f90
blob5cab78b8ca357c86f1419df206436164b1214d06
1 ! { dg-do run }
2 ! PR42901 Reading array of structures from namelist
3 ! Test case derived from the reporters test case.
4 program test_nml
5 type field_descr
6 integer number
7 end type
8 type fsetup
9 type (field_descr), dimension(3) :: vel ! 3 velocity components
10 end type
11 type (fsetup) field_setup
12 namelist /nl_setup/ field_setup
13 field_setup%vel%number = 0
14 ! write(*,nml=nl_setup)
15 open(10, status="scratch")
16 write(10,'(a)') "&nl_setup"
17 write(10,'(a)') " field_setup%vel(1)%number= 3,"
18 write(10,'(a)') " field_setup%vel(2)%number= 9,"
19 write(10,'(a)') " field_setup%vel(3)%number= 27,"
20 write(10,'(a)') "/"
21 rewind(10)
22 read(10,nml=nl_setup)
23 if (field_setup%vel(1)%number .ne. 3) call abort
24 if (field_setup%vel(2)%number .ne. 9) call abort
25 if (field_setup%vel(3)%number .ne. 27) call abort
26 ! write(*,nml=nl_setup)
27 end program test_nml