Contiguity (Fortran 2008)

Contiguous objects occupy a contiguous block of memory. The use of contiguous objects makes it easier to enable optimizations that depend on the memory layout of the objects.

An object is contiguous if it meets one of the following requirements:
An object is not contiguous if it is an array subobject and meets all the following requirements:
Note: In addition to the preceding scenarios, XL Fortran determines whether the object is contiguous, based on its own rules.

Simply contiguous

A simply contiguous array is one that the XL Fortran compiler can determine to be contiguous at compile time.

A section_subscript_list specifies a simply contiguous array section only if it meets all the following requirements:
  • It does not have a vector_subscript.
  • All but the last subscript_triplet is a colon.
  • The last subscript_triplet does not have a stride.
  • No subscript_triplet is preceded by a section_subscript that is a subscript.
An array subobject designator is simply contiguous only if it meets one of the following requirements:
  • An object_name that has the CONTIGUOUS attribute
  • An object_name that is neither a pointer nor an assumed shape array
  • A structure component whose rightmost part_name is an array. The rightmost part_name either has the CONTIGUOUS attribute or is not a pointer.
  • An array section that meets all the following requirements:
    • It is not a complex part designator.
    • It does not have a substring_range.
    • Its rightmost comp_name has nonzero rank.
    • Its rightmost part_name has the CONTIGUOUS attribute or is neither of assumed shape nor a pointer.
    • It either does not have a section_subscript_list, or has a section_subscript_list which specifies a simply contiguous section.
An array variable is simply contiguous only if it meets one of the following requirements:
  • It is an array subobject designator that is simply contiguous.
  • It is a reference to a function that returns a pointer with the CONTIGUOUS attribute.
Note: In addition to the preceding scenarios, XL Fortran may determine contiguity at compile time, based on its own rules.

Related information