The Fortran 2008 Standard introduced the CONTIGUOUS attribute for assumed shape arrays and pointers. The CONTIGUOUS attribute may help the compiler optimize more effectively, see /content/www/us/en/develop/articles/vectorization-and-array-contiguity.html. However, specifying the CONTIGUOUS attribute for an assumed shape array or pointer that may not be contiguous can lead to incorrect behavior at run-time. First introduced in the Intel® Fortran Compiler version 18, the compiler option, -check contiguous, allows an application to check at run-time whether the targets of contiguous pointer assignments are indeed contiguous.
Consider the following example:
Without the contiguity attribute, results are correct.
Here, pointer c is declared as contiguous, but the actual target is not, leading to incorrect results.
With the new option -check contiguous (Linux* or macOS*) or /check:contiguous (Windows*), the compiler adds run-time tests for the assignment of a contiguous pointer to a non-contiguous target. The option -traceback (/traceback) identifies the function and source file line number at which the incorrect assignment took place. It is not necessary to compile with the debugging option -g (Linux or macOS) or /Zi (Windows) in order to get this traceback.