Merge with trank @ 137446
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_3.f90
blob34d4f1625fb6523c5c4b33152ca1904eebfcf311
1 ! { dg-do run }
3 ! PROCEDURE POINTERS without the PROCEDURE statement
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7 real function e1(x)
8 real :: x
9 print *,'e1!',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 print *,'e2!',a,b
17 a = a + b
18 end subroutine
20 program proc_ptr_3
22 real, external, pointer :: fp
24 pointer :: sp
25 interface
26 subroutine sp(a,b)
27 real, intent(inout) :: a
28 real, intent(in) :: b
29 end subroutine sp
30 end interface
32 external :: e1,e2
33 real :: c = 1.2
35 fp => e1
37 if (abs(fp(2.5)-7.5)>0.01) call abort()
39 sp => e2
41 call sp(c,3.4)
43 if (abs(c-4.6)>0.01) call abort()
45 end