| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR 36322/36463 |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module m |
| 8 |
|
| 9 |
contains |
| 10 |
|
| 11 |
pure integer function mysize(a) |
| 12 |
integer,intent(in) :: a(:) |
| 13 |
mysize = size(a) |
| 14 |
end function |
| 15 |
|
| 16 |
end module |
| 17 |
|
| 18 |
|
| 19 |
program prog |
| 20 |
|
| 21 |
use m |
| 22 |
implicit none |
| 23 |
|
| 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 |
| 35 |
|
| 36 |
procedure(abs_fun) :: p |
| 37 |
|
| 38 |
integer :: k,j(3),i(3) = (/1,2,3/) |
| 39 |
|
| 40 |
j = p(i,mysize) |
| 41 |
|
| 42 |
do k=1,mysize(i) |
| 43 |
if (j(k) /= 2*i(k)) STOP 1 |
| 44 |
end do |
| 45 |
|
| 46 |
end |
| 47 |
|
| 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 |