URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [dynamic_dispatch_4.f03] - Rev 694
Compare with Previous | Blame | View Log
! { dg-do run }! Tests the fix for PR41648 in which the reference a%a%getit () was wrongly! identified as a recursive call to getit.!! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>!module foo_modtype foointeger :: icontainsprocedure, pass(a) :: doitprocedure, pass(a) :: getitend type fooprivate doit,getitcontainssubroutine doit(a)class(foo) :: aa%i = 1end subroutine doitfunction getit(a) result(res)class(foo) :: ainteger :: resres = a%iend function getitend module foo_modmodule s_bar_moduse foo_modtype, extends(foo) :: s_bartype(foo), allocatable :: acontainsprocedure, pass(a) :: doitprocedure, pass(a) :: getitend type s_barprivate doit,getitcontainssubroutine doit(a)class(s_bar) :: aallocate (a%a)call a%a%doit()end subroutine doitfunction getit(a) result(res)class(s_bar) :: ainteger :: resres = a%a%getit () * 2end function getitend module s_bar_modmodule a_bar_moduse foo_modtype, extends(foo) :: a_bartype(foo), allocatable :: a(:)containsprocedure, pass(a) :: doitprocedure, pass(a) :: getitend type a_barprivate doit,getitcontainssubroutine doit(a)class(a_bar) :: aallocate (a%a(1))call a%a(1)%doit ()end subroutine doitfunction getit(a) result(res)class(a_bar) :: ainteger :: resres = a%a(1)%getit () * 3end function getitend module a_bar_moduse s_bar_moduse a_bar_modtype(foo), target :: btype(s_bar), target :: ctype(a_bar), target :: dclass(foo), pointer :: aa => bcall a%doitif (a%getit () .ne. 1) call aborta => ccall a%doitif (a%getit () .ne. 2) call aborta => dcall a%doitif (a%getit () .ne. 3) call abortend! { dg-final { cleanup-modules "foo_mod s_bar_mod a_bar_mod" } }
