summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/namelist_61.f90
blob: c7214dd2bb946fd6136f879979839381400c9da8 (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
35
! { dg-do run }
!
! PR fortran/43228
!
integer :: a(3,3)
character(len=100) :: str
namelist /nml/a

a = -1
str = '&nml a(1,:) = 1 2 3 /'
read(str, nml=nml)
if (any (a(1,:) /= [1, 2, 3])) call abort ()
if (any (a([2,3],:) /= -1)) call abort ()

a = -1
str = '&nml a(1,1) = 1 2 3 4 /'
read(str, nml=nml)
if (any (a(:,1) /= [1, 2, 3])) call abort ()
if (any (a(:,2) /= [4, -1, -1])) call abort ()
if (any (a(:,3) /= -1)) call abort ()

str = '&nml a(1,:) = 1 2 3 , &
       &    a(2,:) = 4,5,6 &
       &    a(3,:) = 7 8 9/'
read(str, nml=nml)
if (any (a(1,:) /= [1, 2, 3])) call abort ()
if (any (a(2,:) /= [4, 5, 6])) call abort ()
if (any (a(3,:) /= [7, 8, 9])) call abort ()

!print *, a(:,1)
!print *, a(:,2)
!print *, a(:,3)
end