[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve18.f90
blobc917a68f92d2407c0a7f93bf3bc2b90e2931f4bd
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 module m1
4 implicit none
5 contains
6 subroutine foo(x)
7 real :: x
8 end subroutine
9 end module
11 !Note: PGI, Intel, GNU, and NAG allow this; Sun does not
12 module m2
13 use m1
14 implicit none
15 !ERROR: 'foo' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
16 interface foo
17 module procedure s
18 end interface
19 contains
20 subroutine s(i)
21 integer :: i
22 end subroutine
23 end module
25 subroutine foo
26 !ERROR: Cannot use-associate 'foo'; it is already declared in this scope
27 use m1
28 end
30 subroutine bar
31 !ERROR: Cannot use-associate 'bar'; it is already declared in this scope
32 use m1, bar => foo
33 end
35 !OK to use-associate a type with the same name as a generic
36 module m3a
37 type :: foo
38 end type
39 end
40 module m3b
41 use m3a
42 interface foo
43 end interface
44 end
46 ! Can't have derived type and function with same name
47 module m4a
48 type :: foo
49 end type
50 contains
51 !ERROR: 'foo' is already declared in this scoping unit
52 function foo(x)
53 end
54 end
55 ! Even if there is also a generic interface of that name
56 module m4b
57 type :: foo
58 end type
59 !ERROR: 'foo' is already declared in this scoping unit
60 interface foo
61 procedure :: foo
62 end interface foo
63 contains
64 function foo(x)
65 end
66 end
67 module m4c
68 type :: foo
69 end type
70 interface foo
71 !ERROR: 'foo' is already declared in this scoping unit
72 real function foo()
73 end function foo
74 end interface foo
75 end
77 ! Use associating a name that is a generic and a derived type
78 module m5a
79 interface g
80 end interface
81 type g
82 end type
83 end module
84 module m5b
85 use m5a
86 interface g
87 procedure f
88 end interface
89 type(g) :: x
90 contains
91 function f(i)
92 end function
93 end module
94 subroutine s5
95 use m5b
96 type(g) :: y
97 end
99 module m6
100 real :: f6
101 interface g6
102 !ERROR: 'f6' is already declared in this scoping unit
103 real function f6()
104 end function f6
105 end interface g6
106 end module m6
108 module m7
109 integer :: f7
110 interface g7
111 !ERROR: 'f7' is already declared in this scoping unit
112 real function f7()
113 end function f7
114 end interface g7
115 end module m7
117 module m8
118 real :: f8
119 interface g8
120 !ERROR: 'f8' is already declared in this scoping unit
121 subroutine f8()
122 end subroutine f8
123 end interface g8
124 end module m8
126 module m9
127 type f9
128 end type f9
129 !ERROR: 'f9' is already declared in this scoping unit
130 interface f9
131 real function f9()
132 end function f9
133 end interface f9
134 contains
135 function f9(x)
136 end function f9
137 end module m9
139 module m10
140 type :: t10
141 end type t10
142 interface f10
143 function f10()
144 end function f10
145 end interface f10
146 contains
147 !ERROR: 'f10' is already declared in this scoping unit
148 function f10(x)
149 end function f10
150 end module m10
152 module m11
153 type :: t11
154 end type t11
155 interface i11
156 function f11()
157 end function f11
158 end interface i11
159 contains
160 !ERROR: 'f11' is already declared in this scoping unit
161 function f11(x)
162 end function f11
163 end module m11
165 module m12
166 interface f12
167 function f12()
168 end function f12
169 end interface f12
170 contains
171 !ERROR: 'f12' is already declared in this scoping unit
172 function f12(x)
173 end function f12
174 end module m12
176 module m13
177 interface f13
178 function f13()
179 end function f13
180 end interface f13
181 contains
182 !ERROR: 'f13' is already declared in this scoping unit
183 function f13()
184 end function f13
185 end module m13