OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [cray_pointers_7.f90] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! { dg-options "-fcray-pointer" }
3
 
4
! Test the implementation of Cray pointers to procedures.
5
program cray_pointers_7
6
  implicit none
7
  integer tmp
8
  integer, external :: fn
9
  external sub
10
 
11
  ! We can't mix function and subroutine pointers.
12
  pointer (subptr,subpte)
13
  pointer (fnptr,fnpte)
14
 
15
  ! Declare pointee types.
16
  external subpte
17
  integer, external :: fnpte
18
 
19
  tmp = 0
20
 
21
  ! Check pointers to subroutines.
22
  subptr = loc(sub)
23
  call subpte(tmp)
24
  if (tmp .ne. 17) call abort()
25
 
26
  ! Check pointers to functions.
27
  fnptr = loc(fn)
28
  tmp = fnpte(7)
29
  if (tmp .ne. 14) call abort()
30
 
31
end program cray_pointers_7
32
 
33
! Trivial subroutine to be called through a Cray pointer.
34
subroutine sub(i)
35
  integer i
36
  i = 17
37
end subroutine sub
38
 
39
! Trivial function to be called through a Cray pointer.
40
function fn(i)
41
  integer fn,i
42
  fn = 2*i
43
end function fn

powered by: WebSVN 2.1.0

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