FRIDAY, AUGUST 28, 2026
fortran
Fortran array descriptors: Centralize initialization for function results
Fortran compiler refactors initialization code for array descriptors of function results.
The Fortran compiler has extracted the code that initializes array descriptors for allocatable array function results into a new function. This improves code clarity and maintainability by centralizing the logic for setting the initial unallocated status.
In Details
A new function, gfc_init_descriptor_result in trans-descriptor.cc, consolidates the initialization of array descriptors for allocatable array function results. This sets the data field to null to reflect the initially unallocated state, previously handled within gfc_trans_deferred_vars.
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.
- trans-descriptor.cc
- A GCC source file containing functions for creating and manipulating array descriptors during the intermediate representation (IR) translation phase.