GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
fortran

Fortran: Fixes for Parameterized Derived Type errors in namelist I/O

Corrects errors in Fortran namelist I/O for Parameterized Derived Types (PDTs), improving handling of PDT arrays.

This commit addresses errors related to Parameterized Derived Types (PDTs) in Fortran’s namelist I/O, specifically for PR82173. The changes involve removing redundant NOPs from the data pointer in nml_get_addr_expr and ensuring that descriptors for PDT arrays are correctly passed in transfer_namelist_element. A new test case is included to verify these fixes.

In Details

This patch targets PR fortran/82173, addressing issues with Parameterized Derived Types (PDTs) in Fortran namelist I/O. The changes in trans-io.cc involve removing no-operation instructions (nops) from the data pointer obtained in nml_get_addr_expr and ensuring that array descriptors for PDTs are passed correctly in transfer_namelist_element. A new test case pdt_bug18.f90 is added.

For Context
Parameterized Derived Type (PDT)
A user-defined type in Fortran whose structure or behavior can be modified by type parameters, which are specified when the type is declared. This allows for more flexible and generic data structures.
Namelist I/O
A Fortran input/output facility that allows data to be read from or written to files using named lists of variables, providing a convenient way to manage program data without explicit format specifications.
NOP
No Operation. An instruction that does nothing. It's often used as a placeholder or to ensure correct instruction alignment, but can sometimes be redundant and removed by optimizations.
Descriptor
In Fortran, a data structure that holds information about an array, such as its base address, dimensions, and element type. Descriptors are used to manage arrays dynamically and pass them between procedures.
Filed Under: fortranpdtnamelistio