1! RUN: %S/test_errors.sh %s %t %f18
2subroutine s1
3  namelist /nl/x
4  block
5    !ERROR: NAMELIST statement is not allowed in a BLOCK construct
6    namelist /nl/y
7  end block
8end
9
10subroutine s2
11  open(12, file='nl.out')
12  !ERROR: Namelist group 'nl' not found
13  write(12, nml=nl)
14end
15
16subroutine s3
17  real :: x
18  open(12, file='nl.out')
19  !ERROR: 'x' is not the name of a namelist group
20  write(12, nml=x)
21end
22
23module m4
24  real :: x
25  namelist /nl/x
26end
27subroutine s4a
28  use m4
29  namelist /nl2/x
30  open(12, file='nl.out')
31  write(12, nml=nl)
32  write(12, nml=nl2)
33end
34subroutine s4b
35  use m4
36  real :: y
37  !ERROR: 'nl' is already declared in this scoping unit
38  namelist /nl/y
39end
40
41subroutine s5
42  namelist /nl/x
43  !ERROR: The type of 'x' has already been implicitly declared
44  integer x
45end
46
47subroutine s6
48  !ERROR: 's6' is not a variable
49  namelist /nl/ s6
50  !ERROR: 'f' is not a variable
51  namelist /nl/ f
52contains
53  integer function f()
54    f = 1
55  end
56end
57
58subroutine s7
59  real x
60  namelist /nl/ x
61  !ERROR: EXTERNAL attribute not allowed on 'x'
62  external x
63end
64
65subroutine s8
66  data x/1.0/
67  !ERROR: The type of 'x' has already been implicitly declared
68  integer x
69end
70
71subroutine s9
72  real :: x(2,2)
73  !ERROR: 'i' is already declared in this scoping unit
74  data ((x(i,i),i=1,2),i=1,2)/4*0.0/
75end
76
77module m10
78  integer :: x
79  public :: nl
80  namelist /nl/ x
81end
82
83subroutine s11
84  integer :: nl2
85  !ERROR: 'nl2' is already declared in this scoping unit
86  namelist /nl2/x
87  namelist /nl3/x
88  !ERROR: 'nl3' is already declared in this scoping unit
89  integer :: nl3
90  nl2 = 1
91end
92