2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_decl_18.f90
blobc4216135106b90fe1fbf50d4cc76c01ff5e8914c
1 ! { dg-do run }
3 ! PR 36322/36463
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7 module m
9 contains
11 pure integer function mysize(a)
12 integer,intent(in) :: a(:)
13 mysize = size(a)
14 end function
16 end module
19 program prog
21 use m
22 implicit none
24 abstract interface
25 function abs_fun(x,sz)
26 integer,intent(in) :: x(:)
27 interface
28 pure integer function sz(b)
29 integer,intent(in) :: b(:)
30 end function
31 end interface
32 integer :: abs_fun(sz(x))
33 end function
34 end interface
36 procedure(abs_fun) :: p
38 integer :: k,j(3),i(3) = (/1,2,3/)
40 j = p(i,mysize)
42 do k=1,mysize(i)
43 if (j(k) /= 2*i(k)) call abort()
44 end do
46 end
48 function p(y,asz)
49 implicit none
50 integer,intent(in) :: y(:)
51 interface
52 pure integer function asz(c)
53 integer,intent(in) :: c(:)
54 end function
55 end interface
56 integer :: p(asz(y))
57 integer l
58 do l=1,asz(y)
59 p(l) = y(l)*2
60 end do
61 end function