URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
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
|
integer :: i
|
integer :: i
|
contains
|
contains
|
procedure, pass(y) :: foo
|
procedure, 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
|
class(t) :: y
|
class(t) :: y
|
if(present(x)) then
|
if(present(x)) then
|
print *, 'foo', x%i, y%i
|
print *, 'foo', x%i, y%i
|
else
|
else
|
print *, 'foo', y%i
|
print *, 'foo', y%i
|
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 = 3
|
t1%i = 3
|
t2%i = 4
|
t2%i = 4
|
call t1%foo()
|
call t1%foo()
|
call t2%foo()
|
call t2%foo()
|
call t1%foo(t2)
|
call t1%foo(t2)
|
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.