Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Storage Association

Storage association describes the relationships that exist among data objects. It is the association of two or more data objects that occurs when two or more storage sequences share, or are aligned with, one or more storage units. Storage sequences are used to describe relationships among variables, common blocks, and result variables.

Example

The following shows an example of Name, Pointer, and Storage association:


! Scoping Unit 1: An external program unit

REAL A, B(4)
REAL, POINTER :: M(:)
REAL, TARGET :: N(12)
COMMON /COM/...
EQUIVALENCE (A, B(1))        ! Storage association between A and B(1)
M => N                       ! Pointer association
CALL P (actual-arg,...)
...
 
! Scoping Unit 2: An external procedure
SUBROUTINE P (dummy-arg,...)  ! Name and storage association between         
                              !    these arguments and the calling                     
                              !    routine's arguments in scoping unit 1
  COMMON /COM/...             ! Storage association with common block COM
                              !    in scoping unit 1

  REAL Y
  CALL Q (actual-arg,...)
  CONTAINS
    SUBROUTINE Q (dummy-arg,...) ! Name and storage association between                                 
                                 !   these arguments and the calling
                                 !   routine's arguments in host procedure        
                                 !   P (subprogram Q has host association               
                                 !   with procedure P)
      Y = 2.0*(Y-1.0)       ! Name association with Y in host procedure P
    ...