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

Fortran: Scalar type extraction simplified

Fortran scalar type extraction logic moved to callers to simplify a function.

The get_scalar_to_descriptor_type function in the Fortran front-end has been modified to accept the scalar’s type directly as an argument, rather than accessing it via TREE_TYPE(). This change shifts the responsibility of extracting the type to the calling functions (gfc_conv_scalar_to_descriptor, gfc_conv_derived_to_class, gfc_conv_class_to_class), simplifying the get_scalar_to_descriptor_type function itself and addressing PR122521.

In Details

The get_scalar_to_descriptor_type function in the Fortran front-end's trans-expr.cc is modified to accept scalar_type directly, removing the scalar argument and the TREE_TYPE(scalar) access. Callers are updated to pass the type explicitly. This change simplifies the function's interface and is part of a larger refactoring effort for array descriptor handling under PR122521.

For Context
TREE_TYPE
A macro or function in GCC's internal representation (tree) that retrieves the type information associated with a tree node.
scalar
In programming, a scalar is a single value (e.g., an integer, float, or character) as opposed to an aggregate data type like an array or structure.
array descriptor
A data structure used in Fortran to represent an array, containing information about its base address, dimensions, strides, and other properties.
trans-expr.cc
A GCC source file containing code for translating Fortran expressions into intermediate representation.
Filed Under: fortranrefactorcompiler