Plugins: Add label-text.h to CPPLIB_H so it will be installed [PR115288]
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_77.f90
blob924074b29211828e8d479c2294ae61944ff20969
1 ! { dg-do run }
3 ! PR libfortran/51825 - Fortran runtime error: Cannot match namelist object name
4 ! Test case derived from PR.
6 module local_mod
8 type mytype1
9 integer :: int1
10 end type
12 type mytype2
13 integer :: n_x
14 integer :: n_px
15 end type
17 type beam_init_struct
18 character(16) :: chars(1) = ''
19 type (mytype1) dummy
20 type (mytype2) grid(1)
21 end type
23 end module
25 program error_namelist
27 use local_mod
29 implicit none
31 type (beam_init_struct) beam_init
33 namelist / error_params / beam_init
35 open (10, status='scratch')
36 write (10, '(a)') "&error_params"
37 write (10, '(a)') " beam_init%chars(1)='JUNK'"
38 write (10, '(a)') " beam_init%grid(1)%n_x=3"
39 write (10, '(a)') " beam_init%grid(1)%n_px=2"
40 write (10, '(a)') "/"
41 rewind(10)
42 read(10, nml=error_params)
43 close (10)
45 if (beam_init%chars(1) /= 'JUNK') STOP 1
46 if (beam_init%grid(1)%n_x /= 3) STOP 2
47 if (beam_init%grid(1)%n_px /= 2) STOP 3
49 end program