HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
EQUIVALENCE
Chapter 10356
Consider the following example, which puts array i in blank common and equivalences array
element j(2) to i(3):
INTEGER :: i(6), j(6)
COMMON i
EQUIVALENCE (i(3), j(2))
The effect of the EQUIVALENCE statement is to extend blank common to include element j(6).
This is entirely legal because the extension occurs at the end of the common block.
But if the EQUIVALENCE statement were changed as follows:
EQUIVALENCE (i(1), j(2)) ! illegal
it would result in an illegal equivalence, because storage would have to be inserted in front of
the block in order to accommodate element j(1).
Examples
In the following example, the variables a, b, and c share the same storage space; array
elements d(2) and e(5) share the same storage space; variables f, g, and h share the same
storage:
INTEGER :: a, b, c, d(20), e(30), f, g, h
EQUIVALENCE (a, b, c), (d(2), e(5)), (f, g, h)
Related statements
COMMON
Related concepts
For information about data alignment, see Table 5-1 and “Alignment of derived-type objects”
on page 127.