File: resolve114.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (90 lines) | stat: -rw-r--r-- 2,632 bytes parent folder | download | duplicates (4)
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
! RUN: %python %S/test_errors.py %s %flang_fc1
! Allow the same external or intrinsic procedure to be use-associated
! by multiple paths when they are unambiguous.
module m1
  intrinsic :: sin
  intrinsic :: iabs
  interface
    subroutine ext1(a, b)
      integer, intent(in) :: a(:)
      real, intent(in) :: b(:)
    end subroutine
    subroutine ext2(a, b)
      real, intent(in) :: a(:)
      integer, intent(in) :: b(:)
    end subroutine
  end interface
end module m1

module m2
  intrinsic :: sin, tan
  intrinsic :: iabs, idim
  interface
    subroutine ext1(a, b)
      integer, intent(in) :: a(:)
      real, intent(in) :: b(:)
    end subroutine
    subroutine ext2(a, b)
      real, intent(in) :: a(:)
      integer, intent(in) :: b(:)
    end subroutine
  end interface
end module m2

subroutine s2a
  use m1
  use m2
  procedure(sin), pointer :: p1 => sin
  procedure(iabs), pointer :: p2 => iabs
  procedure(ext1), pointer :: p3 => ext1
  procedure(ext2), pointer :: p4 => ext2
end subroutine

subroutine s2b
  use m1, only: x1 => sin, x2 => iabs, x3 => ext1, x4 => ext2
  use m2, only: x1 => sin, x2 => iabs, x3 => ext1, x4 => ext2
  use m1, only: iface1 => sin, iface2 => iabs, iface3 => ext1, iface4 => ext2
  procedure(iface1), pointer :: p1 => x1
  procedure(iface2), pointer :: p2 => x2
  procedure(iface3), pointer :: p3 => x3
  procedure(iface4), pointer :: p4 => x4
end subroutine

module m3
  use m1
  use m2
end module
subroutine s3
  use m3
  procedure(sin), pointer :: p1 => sin
  procedure(iabs), pointer :: p2 => iabs
  procedure(ext1), pointer :: p3 => ext1
  procedure(ext2), pointer :: p4 => ext2
end subroutine

module m4
  use m1, only: x1 => sin, x2 => iabs, x3 => ext1, x4 => ext2
  use m2, only: x1 => sin, x2 => iabs, x3 => ext1, x4 => ext2
end module
subroutine s4
  use m4
  use m1, only: iface1 => sin, iface2 => iabs, iface3 => ext1, iface4 => ext2
  procedure(iface1), pointer :: p1 => x1
  procedure(iface2), pointer :: p2 => x2
  procedure(iface3), pointer :: p3 => x3
  procedure(iface4), pointer :: p4 => x4
end subroutine

subroutine s5
  use m1, only: x1 => sin, x2 => iabs, x3 => ext1, x4 => ext2
  use m2, only: x1 => tan, x2 => idim, x3 => ext2, x4 => ext1
  use m1, only: iface1 => sin, iface2 => iabs, iface3 => ext1, iface4 => ext2
  !ERROR: Reference to 'x1' is ambiguous
  procedure(iface1), pointer :: p1 => x1
  !ERROR: Reference to 'x2' is ambiguous
  procedure(iface2), pointer :: p2 => x2
  !ERROR: Reference to 'x3' is ambiguous
  procedure(iface3), pointer :: p3 => x3
  !ERROR: Reference to 'x4' is ambiguous
  procedure(iface4), pointer :: p4 => x4
end subroutine