Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

4.3.7 Usage of Cray Pointers

Cray pointers can be assigned values as follows:

  • Set to an absolute address

    Example: q = 0

  • Assigned to or from integer variables, plus or minus expressions

    Example: p = q + 100

  • Cray pointers are not integers. You cannot assign them to a real variable.

  • The LOC function (nonstandard) can be used to define a Cray pointer.

    Example: p = LOC( x )

Example: Use Cray pointers as described above.

    SUBROUTINE  sub ( n )
    COMMON pool(100000)
    INTEGER blk(128), word64
    REAL a(1000), b(n), c(100000-n-1000)
    POINTER ( pblk, blk ), (ia, a ), ( ib, b ), &
            ( ic, c ), ( address, word64 )
    DATA address / 64 /
    pblk = 0
    ia = LOC( pool )
    ib = ia + 4000
    ic = ib + n
    ...

Remarks about the above example:

  • word64 refers to the contents of absolute address 64

  • blk is an array that occupies the first 128 words of memory

  • a is an array of length 1000 located in blank common

  • b follows a and is of length n

  • c follows b

  • a, b, and c are associated with pool

  • word64 is the same as blk(17) because Cray pointers are byte address and the integer elements of blk are each 4 bytes long