URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [func_derived_4.f90] - Rev 823
Go to most recent revision | Compare with Previous | Blame | View Log
! { dg-do run }! PR fortran/30793! Check that pointer-returing functions! work derived types.!! Contributed by Salvatore Filippone.!module class_meshtype meshreal(kind(1.d0)), allocatable :: area(:)end type meshcontainssubroutine create_mesh(msh)type(mesh), intent(out) :: mshallocate(msh%area(10))returnend subroutine create_meshend module class_meshmodule class_fielduse class_meshimplicit noneprivate ! Defaultpublic :: create_field, fieldpublic :: msh_type fieldprivatetype(mesh), pointer :: msh => null()integer :: isize(2)end type fieldinterface msh_module procedure msh_end interfaceinterface create_fieldmodule procedure create_fieldend interfacecontainssubroutine create_field(fld,msh)type(field), intent(out) :: fldtype(mesh), intent(in), target :: mshfld%msh => mshfld%isize = 1end subroutine create_fieldfunction msh_(fld)type(mesh), pointer :: msh_type(field), intent(in) :: fldmsh_ => fld%mshend function msh_end module class_fieldmodule class_scalar_fielduse class_fieldimplicit noneprivatepublic :: create_field, scalar_fieldpublic :: msh_type scalar_fieldprivatetype(field) :: basereal(kind(1.d0)), allocatable :: x(:)real(kind(1.d0)), allocatable :: bx(:)real(kind(1.d0)), allocatable :: x_old(:)end type scalar_fieldinterface create_fieldmodule procedure create_scalar_fieldend interfaceinterface msh_module procedure get_scalar_field_mshend interfacecontainssubroutine create_scalar_field(fld,msh)use class_meshtype(scalar_field), intent(out) :: fldtype(mesh), intent(in), target :: mshcall create_field(fld%base,msh)allocate(fld%x(10),fld%bx(20))end subroutine create_scalar_fieldfunction get_scalar_field_msh(fld)use class_meshtype(mesh), pointer :: get_scalar_field_mshtype(scalar_field), intent(in), target :: fldget_scalar_field_msh => msh_(fld%base)end function get_scalar_field_mshend module class_scalar_fieldprogram test_pntuse class_meshuse class_scalar_fieldimplicit nonetype(mesh) :: mshtype(mesh), pointer :: mshptype(scalar_field) :: qualitycall create_mesh(msh)call create_field(quality,msh)mshp => msh_(quality)end program test_pnt! { dg-final { cleanup-modules "class_mesh class_scalar_field class_mesh" } }
Go to most recent revision | Compare with Previous | Blame | View Log
