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

Fortran: Fix invalid memory reference for class PDT intent out

Fortran compiler now correctly handles class PDT intent out in assignments, preventing invalid memory references.

A fix in the Fortran compiler addresses an invalid memory reference issue related to class PDT (parameterized derived type) intent out. The change ensures that a check for a NULL right-hand side is applied to class PDTs, similar to unlimited polymorphic expressions, thereby preventing potential crashes or incorrect behavior during assignments.

In Details

This patch resolves PR128886 in the Fortran front-end, specifically within gfc_trans_class_array_init_assign. It corrects a condition where class PDTs with intent(out) were not properly checked for NULL rhs values, which is necessary for their correct handling during initialization and assignment, analogous to how unlimited polymorphic expressions are treated.

For Context
PDT
Parameterized Derived Type in Fortran. A derived type whose definition includes parameters that can be specified when the type is declared, allowing for more flexible and generic type definitions.
intent(out)
A Fortran procedure argument attribute specifying that the argument is intended to be written to by the procedure. The initial value of such arguments is undefined.
Filed Under: fortranbugfix