File: intrinsics03.f90

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (125 lines) | stat: -rw-r--r-- 6,312 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
! RUN: %python %S/test_errors.py %s %flang_fc1
! Ensure that INDEX is a usable specific intrinsic procedure.

program test
  interface
    pure integer function index1(string, substring)
      character(*), intent(in) :: string, substring ! ok
    end
    pure integer function index2(x1, x2)
      character(*), intent(in) :: x1, x2 ! ok
    end
    pure integer function index3(string, substring)
      character, intent(in) :: string, substring ! not assumed length
    end
    pure integer function index4(string, substring, back)
      character(*), intent(in) :: string, substring
      logical, optional, intent(in) :: back ! not ok
    end
    subroutine s0(ix)
      procedure(index) :: ix
    end
    subroutine s1(ix)
      import index1
      procedure(index1) :: ix
    end
    subroutine s2(ix)
      import index2
      procedure(index2) :: ix
    end
    subroutine s3(ix)
      import index3
      procedure(index3) :: ix
    end
    subroutine s4(ix)
      import index4
      procedure(index4) :: ix
    end
  end interface

  procedure(index), pointer :: p0
  procedure(index1), pointer :: p1
  procedure(index2), pointer :: p2
  procedure(index3), pointer :: p3
  procedure(index4), pointer :: p4

  p0 => index ! ok
  p0 => index1 ! ok
  p0 => index2 ! ok
  !ERROR: Procedure pointer 'p0' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p0 => index3
  !ERROR: Procedure pointer 'p0' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
  p0 => index4
  p1 => index ! ok
  p1 => index1 ! ok
  p1 => index2 ! ok
  !ERROR: Procedure pointer 'p1' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p1 => index3
  !ERROR: Procedure pointer 'p1' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
  p1 => index4
  p2 => index ! ok
  p2 => index1 ! ok
  p2 => index2 ! ok
  !ERROR: Procedure pointer 'p2' associated with incompatible procedure designator 'index3': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p2 => index3
  !ERROR: Procedure pointer 'p2' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
  p2 => index4
  !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p3 => index
  !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index1': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p3 => index1
  !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index2': incompatible dummy argument #1: assumed-length character vs explicit-length character
  p3 => index2
  p3 => index3 ! ok
  !ERROR: Procedure pointer 'p3' associated with incompatible procedure designator 'index4': distinct numbers of dummy arguments
  p3 => index4
  !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index': distinct numbers of dummy arguments
  p4 => index
  !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index1': distinct numbers of dummy arguments
  p4 => index1
  !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index2': distinct numbers of dummy arguments
  p4 => index2
  !ERROR: Procedure pointer 'p4' associated with incompatible procedure designator 'index3': distinct numbers of dummy arguments
  p4 => index3
  p4 => index4 ! ok

  call s0(index) ! ok
  call s0(index1) ! ok
  call s0(index2)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s0(index3)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s0(index4)
  call s1(index) ! ok
  call s1(index1) ! ok
  call s1(index2) ! ok
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s1(index3)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s1(index4)
  call s2(index) ! ok
  call s2(index1) ! ok
  call s2(index2) ! ok
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s2(index3)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s2(index4)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s3(index)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s3(index1)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': incompatible dummy argument #1: assumed-length character vs explicit-length character
  call s3(index2)
  call s3(index3) ! ok
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s3(index4)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s4(index)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s4(index1)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s4(index2)
  !ERROR: Actual procedure argument has interface incompatible with dummy argument 'ix=': distinct numbers of dummy arguments
  call s4(index3)
  call s4(index4) ! ok
end