PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / cray_pointers_7.f90
blob49c0e03e8f748b1d8dc7bed0b35748102d0b028f
1 ! { dg-do run }
2 ! { dg-options "-fcray-pointer" }
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
11 ! We can't mix function and subroutine pointers.
12 pointer (subptr,subpte)
13 pointer (fnptr,fnpte)
15 ! Declare pointee types.
16 external subpte
17 integer, external :: fnpte
19 tmp = 0
21 ! Check pointers to subroutines.
22 subptr = loc(sub)
23 call subpte(tmp)
24 if (tmp .ne. 17) STOP 1
26 ! Check pointers to functions.
27 fnptr = loc(fn)
28 tmp = fnpte(7)
29 if (tmp .ne. 14) STOP 2
31 end program cray_pointers_7
33 ! Trivial subroutine to be called through a Cray pointer.
34 subroutine sub(i)
35 integer i
36 i = 17
37 end subroutine sub
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