1! { dg-do run }
2! { dg-require-visibility "" }
3!
4! PROCEDURE POINTERS without the PROCEDURE statement
5!
6! Contributed by Janus Weil <janus@gcc.gnu.org>
7
8real function e1(x)
9  real :: x
10  e1 = x * 3.0
11end function
12
13subroutine e2(a,b)
14  real, intent(inout) :: a
15  real, intent(in) :: b
16  a = a + b
17end subroutine
18
19program proc_ptr_3
20
21real, external, pointer :: fp
22
23pointer :: sp
24interface
25  subroutine sp(a,b)
26    real, intent(inout) :: a
27    real, intent(in) :: b
28  end subroutine sp
29end interface
30
31real, external :: e1
32
33interface
34  subroutine e2(a,b)
35    real, intent(inout) :: a
36    real, intent(in) :: b
37  end subroutine e2
38end interface
39
40real :: c = 1.2
41
42fp => e1
43
44if (abs(fp(2.5)-7.5)>0.01) STOP 1
45
46sp => e2
47
48call sp(c,3.4)
49
50if (abs(c-4.6)>0.01) STOP 2
51
52end
53