Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve40.f90
blob310b3c3872a0f88dda64e9d1d747e82343b6729d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 subroutine 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
8 end
10 subroutine s2
11 open(12, file='nl.out')
12 !ERROR: Namelist group 'nl' not found
13 write(12, nml=nl)
14 end
16 subroutine 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)
21 end
23 module m4
24 real :: x
25 namelist /nl/x
26 end
27 subroutine s4a
28 use m4
29 namelist /nl2/x
30 open(12, file='nl.out')
31 write(12, nml=nl)
32 write(12, nml=nl2)
33 end
34 subroutine s4b
35 use m4
36 real :: y
37 !ERROR: 'nl' is already declared in this scoping unit
38 namelist /nl/y
39 end
41 subroutine s5
42 namelist /nl/x
43 integer x
44 end
46 subroutine s6
47 !ERROR: 's6' is not a variable
48 namelist /nl/ s6
49 !ERROR: 'f' is not a variable
50 namelist /nl/ f
51 contains
52 integer function f()
53 f = 1
54 end
55 end
57 subroutine s7
58 real x
59 !ERROR: 'x' is not a variable
60 namelist /nl/ x
61 external x
62 end
64 subroutine s8
65 data x/1.0/
66 !ERROR: The type of 'x' has already been implicitly declared
67 integer x
68 end
70 subroutine s9
71 real :: x(2,2)
72 !ERROR: 'i' is already declared in this scoping unit
73 data ((x(i,i),i=1,2),i=1,2)/4*0.0/
74 end
76 module m10
77 integer :: x
78 public :: nl
79 namelist /nl/ x
80 end
82 subroutine s11
83 integer :: nl2
84 !ERROR: 'nl2' is already declared in this scoping unit
85 namelist /nl2/x
86 namelist /nl3/x
87 !ERROR: 'nl3' is already declared in this scoping unit
88 integer :: nl3
89 nl2 = 1
90 end