| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR libfortran/51825 - Fortran runtime error: Cannot match namelist object name |
| 4 |
! Test case derived from PR. |
| 5 |
|
| 6 |
module local_mod |
| 7 |
|
| 8 |
type mytype1 |
| 9 |
integer :: int1 |
| 10 |
end type |
| 11 |
|
| 12 |
type mytype2 |
| 13 |
integer :: n_x |
| 14 |
integer :: n_px |
| 15 |
end type |
| 16 |
|
| 17 |
type beam_init_struct |
| 18 |
character(16) :: chars(1) = '' |
| 19 |
type (mytype1) dummy |
| 20 |
type (mytype2) grid(1) |
| 21 |
end type |
| 22 |
|
| 23 |
end module |
| 24 |
|
| 25 |
program error_namelist |
| 26 |
|
| 27 |
use local_mod |
| 28 |
|
| 29 |
implicit none |
| 30 |
|
| 31 |
type (beam_init_struct) beam_init |
| 32 |
|
| 33 |
namelist / error_params / beam_init |
| 34 |
|
| 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) |
| 44 |
|
| 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 |
| 48 |
|
| 49 |
end program |