| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 85537: [F08] Invalid memory reference at runtime when calling subroutine through procedure pointer |
| 4 |
! |
| 5 |
! Contributed by Tiziano Müller <[email protected]> |
| 6 |
|
| 7 |
module m1 |
| 8 |
implicit none |
| 9 |
contains |
| 10 |
subroutine foo() |
| 11 |
integer :: a |
| 12 |
|
| 13 |
abstract interface |
| 14 |
subroutine ibar() |
| 15 |
end subroutine |
| 16 |
end interface |
| 17 |
|
| 18 |
procedure(ibar), pointer :: bar_ptr => bar_impl ! { dg-error "invalid in procedure pointer initialization" } |
| 19 |
|
| 20 |
contains |
| 21 |
subroutine bar_impl() |
| 22 |
write (*,*) "foo" |
| 23 |
a = a + 1 |
| 24 |
end subroutine |
| 25 |
|
| 26 |
end subroutine |
| 27 |
end module |
| 28 |
|
| 29 |
|
| 30 |
module m2 |
| 31 |
implicit none |
| 32 |
contains |
| 33 |
subroutine foo(dbar) |
| 34 |
interface |
| 35 |
subroutine dbar() |
| 36 |
end subroutine |
| 37 |
end interface |
| 38 |
|
| 39 |
procedure(dbar), pointer :: bar_ptr => dbar ! { dg-error "invalid in procedure pointer initialization" } |
| 40 |
|
| 41 |
call bar_ptr() |
| 42 |
|
| 43 |
end subroutine |
| 44 |
end module |