Debian Codegraph @

gcc/testsuite/gfortran.dg/interface_63.f90

raw
1 ! { dg-do compile }
2 ! PR fortran/120784 - fix checking of renamed-on-use interface name
3 !
4 ! Contributed by Matt Thompson <matthew.thompson at nasa dot gov>
5
6 module A_mod
7 implicit none
8
9 interface Get
10 procedure :: get_1
11 procedure :: get_2
12 end interface Get
13
14 contains
15
16 subroutine get_1(i)
17 integer :: i
18 i = 5
19 end subroutine get_1
20
21 subroutine get_2(x)
22 real :: x
23 x = 4
24 end subroutine get_2
25 end module A_mod
26
27 module B_mod
28 use A_mod, only : MyGet => Get
29 implicit none
30
31 interface MyGet
32 procedure :: other_get
33 end interface MyGet
34
35 contains
36
37 subroutine other_get(c)
38 character(1) :: c
39 c = 'a'
40 end subroutine other_get
41
42 subroutine check_get ()
43 character :: c
44 integer :: i
45 real :: r
46 call myget (c)
47 call myget (i)
48 call myget (r)
49 end subroutine check_get
50
51 end module B_MOD
52
53 program p
54 use b_mod, only: myget
55 implicit none
56 character :: c
57 integer :: i
58 real :: r
59 call myget (c)
60 call myget (i)
61 call myget (r)
62 end
63
64 ! Check that we do not regress on the following:
65
66 module mod1
67 implicit none
68
69 interface local
70 module procedure local_data
71 end interface local
72
73 contains
74
75 logical function local_data (data) result (local)
76 real, intent(in) :: data
77 local = .true.
78 end function local_data
79
80 end module mod1
81
82 module mod2
83 use mod1, only: local
84 implicit none
85
86 interface local
87 module procedure local_invt
88 end interface local
89
90 contains
91
92 logical function local_invt (invt) result (local)
93 integer, intent(in) :: invt
94 local = .true.
95 end function local_invt
96
97 end module mod2