[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / call02.f90
blob84bb2863866b64966e07f0fe323b13439cec43bc
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! 15.5.1 procedure reference constraints and restrictions
4 subroutine s01(elem, subr)
5 interface
6 !ERROR: A dummy procedure may not be ELEMENTAL
7 elemental real function elem(x)
8 real, intent(in), value :: x
9 end function
10 subroutine subr(dummy)
11 procedure(sin) :: dummy
12 end subroutine
13 subroutine badsubr(dummy)
14 import :: elem
15 !ERROR: A dummy procedure may not be ELEMENTAL
16 procedure(elem) :: dummy
17 end subroutine
18 end interface
19 intrinsic :: cos
20 call subr(cos) ! not an error
21 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
22 call subr(elem) ! C1533
23 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is a null pointer
24 call subr(null())
25 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is typeless
26 call subr(B"1010")
27 end subroutine
29 module m01
30 procedure(sin) :: elem01
31 interface
32 elemental real function elem02(x)
33 real, value :: x
34 end function
35 subroutine callme(f)
36 external f
37 end subroutine
38 end interface
39 contains
40 elemental real function elem03(x)
41 real, value :: x
42 end function
43 subroutine test
44 intrinsic :: cos
45 call callme(cos) ! not an error
46 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument
47 call callme(elem01) ! C1533
48 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument
49 call callme(elem02) ! C1533
50 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument
51 call callme(elem03) ! C1533
52 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument
53 call callme(elem04) ! C1533
54 contains
55 elemental real function elem04(x)
56 real, value :: x
57 end function
58 end subroutine
59 end module
61 module m02
62 type :: t
63 integer, pointer :: ptr
64 end type
65 type(t) :: coarray[*]
66 contains
67 subroutine callee(x)
68 type(t), intent(in) :: x
69 end subroutine
70 subroutine test
71 !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x='
72 call callee(coarray[1]) ! C1537
73 end subroutine
74 end module
76 program p03
77 logical :: l
78 call s1(index)
79 l = index .eq. 0 ! index is an object entity, not an intrinsic
80 call s2(sin)
81 !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure
82 call s3(cos)
83 contains
84 subroutine s2(x)
85 real :: x
86 end
87 subroutine s3(p)
88 procedure(real) :: p
89 end
90 end
92 program p04
93 implicit none
94 !ERROR: No explicit type declared for 'index'
95 call s1(index)
96 end