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