[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve36.f90
blobac8595c2deff90d0ef5bb82f79fa90c8882749a8
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
4 ! C1568 The procedure-name shall have been declared to be a separate module
5 ! procedure in the containing program unit or an ancestor of that program unit.
6 ! C1547 MODULE shall appear only in the function-stmt or subroutine-stmt of a
7 ! module subprogram or of a nonabstract interface body that is declared in the
8 ! scoping unit of a module or submodule.
9 module m1
10 interface
11 module subroutine sub1(arg1)
12 integer, intent(inout) :: arg1
13 end subroutine
14 module integer function fun1()
15 end function
16 end interface
17 type t
18 end type
19 integer i
20 end module
22 submodule(m1) s1
23 contains
24 !ERROR: 'missing1' was not declared a separate module procedure
25 module procedure missing1
26 end
27 !ERROR: 'missing2' was not declared a separate module procedure
28 module subroutine missing2
29 end
30 !ERROR: 't' was not declared a separate module procedure
31 module procedure t
32 end
33 !ERROR: 'i' was not declared a separate module procedure
34 module subroutine i
35 end
36 end submodule
38 module m2
39 interface
40 module subroutine sub1(arg1)
41 integer, intent(inout) :: arg1
42 end subroutine
43 module integer function fun1()
44 end function
45 end interface
46 type t
47 end type
48 !ERROR: Declaration of 'i' conflicts with its use as module procedure
49 integer i
50 contains
51 !ERROR: 'missing1' was not declared a separate module procedure
52 module procedure missing1
53 end
54 !ERROR: 'missing2' was not declared a separate module procedure
55 module subroutine missing2
56 end
57 !ERROR: 't' is already declared in this scoping unit
58 !ERROR: 't' was not declared a separate module procedure
59 module procedure t
60 end
61 !ERROR: 'i' was not declared a separate module procedure
62 module subroutine i
63 end
64 end module
66 ! Separate module procedure defined in same module as declared
67 module m3
68 interface
69 module subroutine sub
70 end subroutine
71 end interface
72 contains
73 module procedure sub
74 end procedure
75 end module
77 ! Separate module procedure defined in a submodule
78 module m4
79 interface
80 module subroutine a
81 end subroutine
82 module subroutine b
83 end subroutine
84 end interface
85 end module
86 submodule(m4) s4a
87 contains
88 module procedure a
89 end procedure
90 end submodule
91 submodule(m4:s4a) s4b
92 contains
93 module procedure b
94 end procedure
95 end
97 !ERROR: 'c1547' is a MODULE procedure which must be declared within a MODULE or SUBMODULE
98 real module function c1547()
99 func = 0.0
100 end function