Successively declared variables in C or Fortran are not necessarily stored at contiguous locations. Thus, care must be exercised that displacements do not cross from one variable to another. Also, in machines with a segmented address space, addresses are not unique and address arithmetic has some peculiar properties. Thus, the use of addresses, that is, displacements relative to the start address MPI_BOTTOM, has to be restricted.
Variables belong to the same sequential storage if they belong to the same array, to the same COMMON block in Fortran, or to the same structure in C. Valid addresses are defined recursively as follows:
The rules above impose no constraints on the use of derived datatypes, as long as they are used to define a communication buffer that is wholly contained within the same sequential storage. However, the construction of a communication buffer that contains variables that are not within the same sequential storage must obey certain restrictions. Basically, a communication buffer with variables that are not within the same sequential storage can be used only by specifying in the communication call buf = MPI_BOTTOM, count = 1, and using a datatype argument where all displacements are valid (absolute) addresses.
[] Advice to users.
It is not expected that MPI implementations will be able to detect
erroneous, ``out of bound'' displacements --- unless those overflow the
user address space --- since the MPI call may not know the extent of the
arrays and records in the host program.
( End of advice to users.)
[] Advice
to implementors.
There is no need to distinguish (absolute) addresses and (relative)
displacements on a machine with contiguous address space:
MPI_BOTTOM is
zero, and both addresses and displacements are integers. On machines where the
distinction is required, addresses are recognized as expressions that involve
MPI_BOTTOM.
( End of advice to implementors.)
Note that in Fortran, Fortran INTEGERs may be too small to contain an
address (e.g., 32 bit INTEGERs on a machine with 64bit pointers).
Because of this, in Fortran, implementations may restrict the use of
absolute addresses to only part of the process memory, and restrict the
use of relative displacements to subranges of the process memory where they
are constrained by the size of Fortran INTEGERs.