URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 302 |
Rev 384 |
! { dg-do run }
|
! { dg-do run }
|
!
|
!
|
! PR 39630: [F03] Procedure Pointer Components with PASS
|
! PR 39630: [F03] Procedure Pointer Components with PASS
|
!
|
!
|
! Contributed by Tobias Burnus
|
! Contributed by Tobias Burnus
|
|
|
module m
|
module m
|
type :: t
|
type :: t
|
sequence
|
sequence
|
integer :: i
|
integer :: i
|
procedure(foo), pointer,pass(y) :: foo
|
procedure(foo), pointer,pass(y) :: foo
|
end type t
|
end type t
|
contains
|
contains
|
subroutine foo(x,y)
|
subroutine foo(x,y)
|
type(t),optional :: x
|
type(t),optional :: x
|
type(t) :: y
|
type(t) :: y
|
if(present(x)) then
|
if(present(x)) then
|
print *, 'foo', x%i, y%i
|
print *, 'foo', x%i, y%i
|
if (mod(x%i+y%i,3)/=2) call abort()
|
if (mod(x%i+y%i,3)/=2) call abort()
|
else
|
else
|
print *, 'foo', y%i
|
print *, 'foo', y%i
|
if (mod(y%i,3)/=1) call abort()
|
if (mod(y%i,3)/=1) call abort()
|
end if
|
end if
|
end subroutine foo
|
end subroutine foo
|
end module m
|
end module m
|
|
|
use m
|
use m
|
type(t) :: t1, t2
|
type(t) :: t1, t2
|
t1%i = 4
|
t1%i = 4
|
t2%i = 7
|
t2%i = 7
|
t1%foo => foo
|
t1%foo => foo
|
t2%foo => t1%foo
|
t2%foo => t1%foo
|
call t1%foo()
|
call t1%foo()
|
call t2%foo()
|
call t2%foo()
|
call t2%foo(t1)
|
call t2%foo(t1)
|
end
|
end
|
|
|
! { dg-final { cleanup-modules "m" } }
|
! { dg-final { cleanup-modules "m" } }
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.