GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
fortran

Fortran compiler fixes simply contiguous property for associate subreferences

Corrects the GFortran compiler's handling of the 'simply contiguous' property for associate names referencing array components or sections.

The GFortran compiler has been updated to correctly determine the ‘simply contiguous’ property for associate names in Fortran. This commit fixes issues where the property was incorrectly forwarded to an associate target, even when the reference involved subcomponents or non-full array sections. The changes ensure that the compiler accurately checks the contiguity of array components and handles non-contiguous sections of associate names associated with contiguous targets.

In Details

In fortran/expr.cc, the gfc_is_simply_contiguous function has been modified to accurately handle associate name references. Previously, it forwarded queries to the associate target for any full array reference, including array components. This commit adds a check to ensure no component reference occurred before forwarding. Additionally, it now forwards queries for non-full array sections, correcting the behavior for associate names tied to non-contiguous targets and ensuring array section checks continue even if the associate target is contiguous.

For Context
Simply contiguous
A Fortran language property that specifies whether an array or array section has its elements stored contiguously in memory, similar to C's arrays. This is important for interoperability and certain performance optimizations.
Associate name
A Fortran construct that creates a temporary name (an alias) for a variable or expression, often used to simplify complex code or refer to parts of data structures.
GFortran
The Fortran compiler provided by the GCC toolchain.
Array component
A field within a Fortran derived type that is an array.
Array section
A subset of an array defined by specifying ranges for one or more dimensions. For example, array(1:5:2) is an array section.
Filed Under: fortrangfortrancontiguous