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

Fortran: Fix errors related to parameterized derived types

Resolves multiple issues in gfortran's handling of parameterized derived types.

This commit addresses several bugs in the Fortran compiler’s support for parameterized derived types (PDTs). It refactors internal structures, corrects type parameter handling during allocation and matching, and adds new test cases to cover the fixed scenarios. These changes improve the robustness of PDT instantiation and class IS matching.

In Details

This series of changes for GCC's Fortran front-end (gfortran) targets Parameterized Derived Types (PDTs). It touches match.cc and resolve.cc, focusing on correcting state corruption in gfc_match_class_is by clearing type_param_spec_list and ensuring correct hash value computation. It also refines resolve_allocate_expr to properly instantiate PDTs from allocate-typespec parameters and introduces helper functions in trans-stmt.cc for PDT parameter handling during allocation and initialization. New tests pdt_bug9.f90 and pdt_bug10.f90 are added.

For Context
Parameterized Derived Type (PDT)
A derived type in Fortran whose components or type parameters depend on other type parameters. This allows for more flexible and generic type definitions.
gfortran
The GNU Fortran compiler, part of the GCC suite.
CLASS IS matching
A Fortran construct used for dynamic type checking and assignment, where an object of a dynamic type is compared against a specific static type.
Filed Under: fortranpdtgfortran