| 1 |
! { dg-do compile } |
| 2 |
! PR 18197: Check that dummy functions with RESULT variable and dimension works. |
| 3 |
module innerfun |
| 4 |
contains |
| 5 |
function f(n,x) result(y) |
| 6 |
integer, intent(in) :: n |
| 7 |
real, dimension(:), intent(in) :: x |
| 8 |
real, dimension(n) :: y |
| 9 |
y = 1 |
| 10 |
end function f |
| 11 |
end module innerfun |
| 12 |
|
| 13 |
module outerfun |
| 14 |
contains |
| 15 |
subroutine foo(n,funname) |
| 16 |
integer, intent(in) :: n |
| 17 |
real, dimension(n) :: y |
| 18 |
real, dimension(2) :: x |
| 19 |
interface |
| 20 |
function funname(n,x) result(y) |
| 21 |
integer, intent(in) :: n |
| 22 |
real, dimension(:), intent(in) :: x |
| 23 |
real, dimension(n) :: y |
| 24 |
end function funname |
| 25 |
end interface |
| 26 |
|
| 27 |
y = funname(n, (/ 0.2, 0.3 /) ) |
| 28 |
|
| 29 |
end subroutine foo |
| 30 |
end module outerfun |
| 31 |
|
| 32 |
program test |
| 33 |
use outerfun |
| 34 |
use innerfun |
| 35 |
call foo(3,f) |
| 36 |
end program test |