Fortran contiguous variables

Fortran 2018 contiguous arrays build upon Fortran 2008. In general, operating on contiguous arrays is faster than non-contiguous arrays. A non-contiguous array actual argument into a contiguous subroutine dummy argument is incorrect syntax. GCC < 9 may fail with SIGSEGV or SIGABRT in this case, dependent on array size. Other compiler correct this incorrect syntax by temporary array copy-in, copy-out which is slower.

Contiguous variables happen by default, so unless you do something with pointers or array striding, the variable is likely to be contiguous for simple Fortran code. To be sure, use is_contiguous intrinsic function. GCC ≥ 9 has is_contiguous and so do other modern Fortran compilers.

References: Fortran 2008 Contiguity