[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / resolve20.f90
blob4d1c6381bb56f3d128866bdedabdb6cefadfad8d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 module m
3 abstract interface
4 subroutine foo
5 end subroutine
6 end interface
8 procedure() :: a
9 procedure(integer) :: b
10 procedure(foo) :: c
11 procedure(bar) :: d
12 !ERROR: 'missing' must be an abstract interface or a procedure with an explicit interface
13 procedure(missing) :: e
14 !ERROR: 'b' must be an abstract interface or a procedure with an explicit interface
15 procedure(b) :: f
16 procedure(c) :: g
17 external :: h
18 !ERROR: 'h' must be an abstract interface or a procedure with an explicit interface
19 procedure(h) :: i
20 procedure(forward) :: j
21 !ERROR: 'bad1' must be an abstract interface or a procedure with an explicit interface
22 procedure(bad1) :: k1
23 !ERROR: 'bad2' must be an abstract interface or a procedure with an explicit interface
24 procedure(bad2) :: k2
25 !ERROR: 'bad3' must be an abstract interface or a procedure with an explicit interface
26 procedure(bad3) :: k3
28 abstract interface
29 subroutine forward
30 end subroutine
31 end interface
33 real :: bad1(1)
34 real :: bad2
35 type :: bad3
36 end type
38 type :: m ! the name of a module can be used as a local identifier
39 end type m
41 external :: a, b, c, d
42 !ERROR: EXTERNAL attribute not allowed on 'm'
43 external :: m
44 !ERROR: EXTERNAL attribute not allowed on 'foo'
45 external :: foo
46 !ERROR: EXTERNAL attribute not allowed on 'bar'
47 external :: bar
49 !ERROR: PARAMETER attribute not allowed on 'm'
50 parameter(m=2)
51 !ERROR: PARAMETER attribute not allowed on 'foo'
52 parameter(foo=2)
53 !ERROR: PARAMETER attribute not allowed on 'bar'
54 parameter(bar=2)
56 type, abstract :: t1
57 integer :: i
58 contains
59 !ERROR: 'proc' must be an abstract interface or a procedure with an explicit interface
60 !ERROR: Procedure component 'p1' has invalid interface 'proc'
61 procedure(proc), deferred :: p1
62 end type t1
64 abstract interface
65 function f()
66 end function
67 end interface
69 contains
70 subroutine bar
71 end subroutine
72 subroutine test
73 !ERROR: Abstract interface 'foo' may not be called
74 call foo()
75 !ERROR: Abstract interface 'f' may not be called
76 x = f()
77 end subroutine
78 end module