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

Fortran array descriptors: Move default initialization of allocatable locals

Fortran compiler centralizes initialization logic for default array descriptors of allocatable local variables.

The Fortran compiler now moves the code that sets up the initial unallocated state for allocatable local array descriptors to a dedicated function. This change centralizes the default initialization of the data pointer to null and sets the correct dtype upon function entry.

In Details

A new function, gfc_init_descriptor_variable in trans-descriptor.cc, is introduced to encapsulate the default initialization of array descriptors for allocatable local variables. This includes setting the data pointer to null and initializing the dtype, previously handled in gfc_trans_deferred_array.

For Context
array descriptor
A data structure used by the Fortran compiler to represent arrays, holding information such as data pointer, type, rank, and bounds.
allocatable
A Fortran attribute that allows an array's size and shape to be determined at runtime and memory to be dynamically allocated.
dtype
Data type, referring to the kind of data an array or variable can hold (e.g., integer, real, character).
trans-descriptor.cc
A GCC source file containing functions for creating and manipulating array descriptors during the intermediate representation (IR) translation phase.
Filed Under: fortrancompilerrefactoring