OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [proc_ptr_comp_2.f90] - Diff between revs 302 and 384

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 302 Rev 384
! { dg-do run }
! { dg-do run }
!
!
! PR39630: Fortran 2003: Procedure pointer components.
! PR39630: Fortran 2003: Procedure pointer components.
!
!
! Basic test for PPCs with FUNCTION interface and NOPASS.
! Basic test for PPCs with FUNCTION interface and NOPASS.
!
!
! Contributed by Janus Weil 
! Contributed by Janus Weil 
  type t
  type t
    procedure(fcn), pointer, nopass :: ppc
    procedure(fcn), pointer, nopass :: ppc
    procedure(abstr), pointer, nopass :: ppc1
    procedure(abstr), pointer, nopass :: ppc1
    integer :: i
    integer :: i
  end type
  end type
  abstract interface
  abstract interface
    integer function abstr(x)
    integer function abstr(x)
      integer, intent(in) :: x
      integer, intent(in) :: x
    end function
    end function
  end interface
  end interface
  type(t) :: obj
  type(t) :: obj
  procedure(fcn), pointer :: f
  procedure(fcn), pointer :: f
  integer :: base
  integer :: base
  intrinsic :: iabs
  intrinsic :: iabs
! Check with interface from contained function
! Check with interface from contained function
  obj%ppc => fcn
  obj%ppc => fcn
  base=obj%ppc(2)
  base=obj%ppc(2)
  if (base/=4) call abort
  if (base/=4) call abort
  call foo (obj%ppc,3)
  call foo (obj%ppc,3)
! Check with abstract interface
! Check with abstract interface
  obj%ppc1 => obj%ppc
  obj%ppc1 => obj%ppc
  base=obj%ppc1(4)
  base=obj%ppc1(4)
  if (base/=8) call abort
  if (base/=8) call abort
  call foo (obj%ppc1,5)
  call foo (obj%ppc1,5)
! Check compatibility components with non-components
! Check compatibility components with non-components
  f => obj%ppc
  f => obj%ppc
  base=f(6)
  base=f(6)
  if (base/=12) call abort
  if (base/=12) call abort
  call foo (f,7)
  call foo (f,7)
contains
contains
  integer function fcn(x)
  integer function fcn(x)
    integer, intent(in) :: x
    integer, intent(in) :: x
    fcn = 2 * x
    fcn = 2 * x
  end function
  end function
  subroutine foo (arg, i)
  subroutine foo (arg, i)
    procedure (fcn), pointer :: arg
    procedure (fcn), pointer :: arg
    integer :: i
    integer :: i
    if (arg(i)/=2*i) call abort
    if (arg(i)/=2*i) call abort
  end subroutine
  end subroutine
end
end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.