Fortran array descriptors: Refactor null actual argument handling
Fortran compiler refactors array descriptor creation for null arguments, fixing initialization and removing a workaround.
The Fortran compiler has refactored the creation of array descriptors for null() actual arguments. Previously, this logic was duplicated, leading to incorrect initialization and type. The changes consolidate this into a common function, ensuring correct initialization and rank. Additionally, a workaround for a gimplification failure related to copy-back code has been removed.
In Details
The Fortran frontend refactors the handling of null() actual arguments by creating a new function gfc_create_null_actual_descriptor in trans-descriptor.cc. This replaces duplicated code in conv_null_actual and corrects issues with descriptor type, rank, and the unintended removal of the scalar descriptor's intent attribute. The changes also remove a workaround for a copy-back gimplification failure.
- array descriptor
- A data structure used by the Fortran compiler to represent arrays, holding information such as data pointer, type, rank, and bounds.
- null() actual argument
- In Fortran, a procedure argument that is explicitly passed as 'null()', often used for optional arguments or to represent an uninitialized state.
- trans-descriptor.cc
- A GCC source file containing functions for creating and manipulating array descriptors during the intermediate representation (IR) translation phase.
- gimplification
- A GCC optimization pass that transforms the Gimple Intermediate Representation (IR) into a simpler form, often involving scalar evolution and copy propagation.
- rank
- The number of dimensions of an array. A scalar has rank 0, a vector has rank 1, and so on.