aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/namelist_78.f90
blob: d4e29ab8228389804a69482ef7f854213b023882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { dg-do run }
!
! PR libfortran/51825
! Test case regarding namelist problems with derived types

program namelist

    type d1
        integer :: j = 0
    end type d1

    type d2
        type(d1) k
    end type d2

    type d3
        type(d2) d(2)
    end type d3

    type(d3) der
    namelist /nmlst/ der

    open (10, status='scratch')
    write (10, '(a)') "&NMLST"
    write (10, '(a)') " DER%D(1)%K%J = 1,"
    write (10, '(a)') " DER%D(2)%K%J = 2,"
    write (10, '(a)') "/"
    rewind(10)
    read(10, nml=nmlst)
    close (10)

    if (der%d(1)%k%j /= 1) call abort
    if (der%d(2)%k%j /= 2) call abort
end program namelist