summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_28.f90
blob: 8754d8e298205e5d68c7e451a4b3a58be40c5bb8 (plain)
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
! { dg-do compile }
!
! PR 44718: Procedure-pointer name is wrongly regarded as "external procedure"
!
! Contributed by John McFarland <john.mcfarland@swri.org>

MODULE m

 IMPLICIT NONE

CONTAINS

 FUNCTION func(x) RESULT(y)
   INTEGER :: x,y
   y = x *2
 END FUNCTION func

 SUBROUTINE sub(x)
   INTEGER :: x
   PRINT*, x
 END SUBROUTINE sub


 SUBROUTINE use_func()
   PROCEDURE(func), POINTER :: f
   INTEGER :: y
   f => func
   y = f(2)
 END SUBROUTINE use_func

 SUBROUTINE use_sub()
   PROCEDURE(sub), POINTER :: f
   f => sub
   CALL f(2)
 END SUBROUTINE use_sub

END MODULE m 

! { dg-final { cleanup-modules "m" } }