TARGET

Purpose

The TARGET statement specifies the TARGET attribute of an entity. An object with the TARGET attribute may have a pointer associated with it.

Syntax

Read syntax diagramSkip visual syntax diagramTARGET:: ,variable_name(array_spec)

Rules

  • If a data object has the TARGET attribute, then all of the data object's nonpointer subobjects will also have the TARGET attribute.
  • A data object that does not have the TARGET attribute cannot be associated with an accessible pointer.
  • A target cannot appear in an EQUIVALENCE statement.
  • IBM extension begins A target cannot be an integer pointer or a pointee.IBM extension ends
Table 1. Attributes compatible with the TARGET attribute
ALLOCATABLE  1  INTENT SAVE
ASYNCHRONOUS OPTIONAL STATIC  3 
AUTOMATIC  3  PRIVATE VALUE  1 
DIMENSION PROTECTED  1  VOLATILE
CONTIGUOUS  2  PUBLIC  
Notes:
  •  1  Fortran 2003
  •  2  Fortran 2008
  •  3  IBM extension

Examples

REAL, POINTER :: A,B
REAL, TARGET  :: C = 3.14
B => C
A => B       ! A points to C

Related information