Pointer assignment statement (=>)

Standard: F77 F90 F95 F2003 F2008 Example program


<Syntax>

pointer-variable => target

target ::= expression | variable

The target must either be a reference to a function that returns a pointer, or a variable with the TARGET or POINTER attribute.

The pointer variable must have the same type, type parameters, and rank as the target (except in the case of remapping).

pointer-variable ( lower-bounds ) => target
lower-bounds ::= expression : [ , expression : ]...

The number of lower bounds must be equal to the rank of the pointer.

pointer-variable ( remapping ) => target
remapping ::= bound-pair [ , bound-pair ]...
bound-pair ::= expression : expression

In the case of remapping, the target must be a rank-one array or a simply contiguous array, but the pointer may have any rank; the number of bound pairs must be equal to the rank of the pointer.

<Semantics>

The pointer assignment statement either copies the association of one pointer to another, or associates a pointer with a variable that has the TARGET attribute. The bounds of the pointer are the same as that of the target (unless different lower bounds are provided, or remapping is being done); if the target is an array section, the lower bounds will all be equal to one and the upper bounds will be equal to the extents.

If the lower bounds are provided, the pointer will have those lower bounds.

If remapping is being done, the pointer will have the bounds specified; in this case the target must not be a disassociated or undefined pointer, and must have at least as many elements as implied by the remapping. This form associates a multi-dimensional pointer with a single-dimensional or simply contiguous target.

<Related>

ALLOCATE statement, DEALLOCATE statement, DIMENSION attribute, NULL intrinsic function, NULLIFY statement, POINTER attribute, TARGET attribute