PR middle-end/77674
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_3.f90
blob1b146819f848dd76883e35d56123b05a0a9b2cb0
1 ! { dg-do run }
2 ! { dg-require-visibility "" }
4 ! PROCEDURE POINTERS without the PROCEDURE statement
6 ! Contributed by Janus Weil <janus@gcc.gnu.org>
8 real function e1(x)
9 real :: x
10 e1 = x * 3.0
11 end function
13 subroutine e2(a,b)
14 real, intent(inout) :: a
15 real, intent(in) :: b
16 a = a + b
17 end subroutine
19 program proc_ptr_3
21 real, external, pointer :: fp
23 pointer :: sp
24 interface
25 subroutine sp(a,b)
26 real, intent(inout) :: a
27 real, intent(in) :: b
28 end subroutine sp
29 end interface
31 real, external :: e1
33 interface
34 subroutine e2(a,b)
35 real, intent(inout) :: a
36 real, intent(in) :: b
37 end subroutine e2
38 end interface
40 real :: c = 1.2
42 fp => e1
44 if (abs(fp(2.5)-7.5)>0.01) call abort()
46 sp => e2
48 call sp(c,3.4)
50 if (abs(c-4.6)>0.01) call abort()
52 end