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:
- It is an object that has the CONTIGUOUS attribute.
- It is a whole array that is neither an array pointer nor an assumed-shape
array.
- It is an array that is allocated by an ALLOCATE statement.
- It is a pointer that is associated with a contiguous target.
- It is an assumed-shape array that is argument associated with
a contiguous array.
- It is a nonzero-sized array section that meets all the following
requirements:
- Its base object is contiguous.
- It does not have a vector_subscript.
- The elements of the section, in array element order, are a subset
of the base object elements that are consecutive in array element
order.
- If the array is of type character and a substring_range is
used, the substring_range specifies all
the characters of the parent string.
- Only its rightmost comp_name has nonzero
rank.
- It is not the real or imaginary part of an array of type complex.
An object is not contiguous if it is an array subobject and meets
all the following requirements:
- The object has two or more elements.
- The elements of the object in array element order are not consecutive
in the elements of the base object.
- The object is not of type character that has zero length.
- The object is not of a derived type that only contains zero-sized
arrays and characters that have zero length.
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.