Remove check for Android in Mips.cpp (#123793)
[llvm-project.git] / flang / test / Semantics / intrinsics03.f90
blob03109bc300caf3a72c5beeef73d76e11be919834
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Ensure that INDEX is a usable specific intrinsic procedure.
4 program test
5 interface
6 pure integer function index1(string, substring)
7 character(*), intent(in) :: string, substring ! ok
8 end
9 pure integer function index2(x1, x2)
10 character(*), intent(in) :: x1, x2 ! ok
11 end
12 pure integer function index3(string, substring)
13 character, intent(in) :: string, substring ! not assumed length
14 end
15 pure integer function index4(string, substring, back)
16 character(*), intent(in) :: string, substring
17 logical, optional, intent(in) :: back ! not ok
18 end
19 subroutine s0(ix)
20 procedure(index) :: ix
21 end
22 subroutine s1(ix)
23 import index1
24 procedure(index1) :: ix
25 end
26 subroutine s2(ix)
27 import index2
28 procedure(index2) :: ix
29 end
30 subroutine s3(ix)
31 import index3
32 procedure(index3) :: ix
33 end
34 subroutine s4(ix)
35 import index4
36 procedure(index4) :: ix
37 end
38 end interface
40 procedure(index), pointer :: p0
41 procedure(index1), pointer :: p1
42 procedure(index2), pointer :: p2
43 procedure(index3), pointer :: p3
44 procedure(index4), pointer :: p4
46 p0 => index ! ok
47 p0 => index1 ! ok
48 p0 => index2 ! ok
49 !ERROR: Procedure pointer 'p0' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
50 p0 => index3
51 !ERROR: Procedure pointer 'p0' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
52 p0 => index4
53 p1 => index ! ok
54 p1 => index1 ! ok
55 p1 => index2 ! ok
56 !ERROR: Procedure pointer 'p1' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
57 p1 => index3
58 !ERROR: Procedure pointer 'p1' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
59 p1 => index4
60 p2 => index ! ok
61 p2 => index1 ! ok
62 p2 => index2 ! ok
63 !ERROR: Procedure pointer 'p2' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
64 p2 => index3
65 !ERROR: Procedure pointer 'p2' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
66 p2 => index4
67 !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index': incompatible dummy argument #1: assumed-length character vs explicit-length character
68 p3 => index
69 !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index1': incompatible dummy argument #1: assumed-length character vs explicit-length character
70 p3 => index1
71 !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index2': incompatible dummy argument #1: assumed-length character vs explicit-length character
72 p3 => index2
73 p3 => index3 ! ok
74 !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
75 p3 => index4
76 !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index': distinct numbers of dummy arguments
77 p4 => index
78 !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index1': distinct numbers of dummy arguments
79 p4 => index1
80 !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index2': distinct numbers of dummy arguments
81 p4 => index2
82 !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index3': distinct numbers of dummy arguments
83 p4 => index3
84 p4 => index4 ! ok
86 call s0(index) ! ok
87 call s0(index1) ! ok
88 call s0(index2)
89 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
90 call s0(index3)
91 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
92 call s0(index4)
93 call s1(index) ! ok
94 call s1(index1) ! ok
95 call s1(index2) ! ok
96 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
97 call s1(index3)
98 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
99 call s1(index4)
100 call s2(index) ! ok
101 call s2(index1) ! ok
102 call s2(index2) ! ok
103 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
104 call s2(index3)
105 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
106 call s2(index4)
107 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
108 call s3(index)
109 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
110 call s3(index1)
111 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
112 call s3(index2)
113 call s3(index3) ! ok
114 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
115 call s3(index4)
116 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
117 call s4(index)
118 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
119 call s4(index1)
120 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
121 call s4(index2)
122 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
123 call s4(index3)
124 call s4(index4) ! ok