Because of the adverse impact that pointers have on optimization, a Fortran 90 pointer may point only to (a) a data object explicitly declared as a pointer target, (b) a dynamically created object, or (c) another pointer. This makes it possible for static storage optimization technology to be be applied to data that has neither the pointer nor target attributes.
Such pointers may be used for arrays whose sizes are determined at run time, such as dynamically allocated arrays; such arrays are declared as ``deferred shape" arrays, in which the rank is specified, and thereby fixed, but the extent in each dimension is unspecified and dynamic. These dimensions will be dynamically established later. The following examples illustrate such dynamic behavior. (The ``=>" is the Fortran 90 syntax for pointer assignment, and the ALLOCATE statement is used for dynamic allocation of storage.)
REAL, TARGET :: B(100,100) ! Array B has the target attribute. REAL, POINTER :: U(:,:),V(:),W(:,:) ! Declaration of 3 pointer arrays ... U => B(I:I+2,J:J+2) ! U points to a 3x3 section of B. ALLOCATE ( W(M,N) ) ! Dynamically allocate W, size MxN V => B(:,J) ! V points to the Jth column of B. V => W(I-1,1:N:2) ! V changed to point to (part of) ! the I-1st row of W.