When the compiler knows that an array occupies a contiguous block of memory, it can perform optimizations based on memory layout. Explicit shape arrays, assumed-size arrays and allocatable arrays occupy contiguous blocks of memory. For array pointers and assumed shape arrays, the compiler cannot determine at compile time if it is the case.
In the latest AIX XL Fortran compiler,
-qassert=contiguous was introduced to allow the programmer to indicate to the compiler that:
* all array pointers are pointer associated with contiguous targets.
* all assumed shape arrays are argument associated with contiguous actual arguments.
When these assertions are made, the compiler can perform more optimizations. But if any of the array pointers or assumed shape arrays in the code are not associated with a contiguous array,
-qassert=contiguous cannot be used anymore and an opportunity for optimizing and accelerating the code can be missed.
Fortran 2008 introduces a new attribute:
CONTIGUOUS. It allows the programmer to let the compiler know which array pointers/assumed shape arrays will be associated with a contiguous array. F2008 also introduces the concept of simply contiguous arrays. Simply contiguous arrays are known to be contiguous arrays at compile time and will stay contiguous throughout the execution of the program. It presents the compiler with another opportunity for more optimization.