| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-std=f2003" } |
| 3 |
! |
| 4 |
! PR fortran/36592 |
| 5 |
! |
| 6 |
! Procedure Pointers inside COMMON blocks. |
| 7 |
! (Allowed in F03, but forbidden in F08.) |
| 8 |
! |
| 9 |
! Contributed by Janus Weil <[email protected]>. |
| 10 |
|
| 11 |
subroutine one() |
| 12 |
implicit none |
| 13 |
procedure(real), pointer :: p1,p2 |
| 14 |
integer :: a,b |
| 15 |
common /com/ p1,p2,a,b |
| 16 |
if (a/=5 .or. b/=-9 .or. p1(0.0)/=1.0 .or. p2(0.0)/=0.0) STOP 1 |
| 17 |
end subroutine one |
| 18 |
|
| 19 |
program main |
| 20 |
implicit none |
| 21 |
integer :: x,y |
| 22 |
intrinsic sin,cos |
| 23 |
procedure(real), pointer :: func1 |
| 24 |
real, external :: func2 |
| 25 |
pointer func2 |
| 26 |
common /com/ func1,func2,x,y |
| 27 |
x = 5 |
| 28 |
y = -9 |
| 29 |
func1 => cos |
| 30 |
func2 => sin |
| 31 |
call one() |
| 32 |
end program main |
| 33 |
|