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

Fortran: Fix parameterized string issues and add test

Corrects handling of parameterized strings in Fortran and adds a new test case.

This commit resolves several issues related to parameterized strings in the Fortran compiler, specifically addressing PR127146. It modifies gfc_match_rvalue to prioritize the entry’s name from the parameter list over the component name when available. A new test case, pdt_96.f03, has been added to verify these fixes.

In Details

Fixes PR fortran/127146 by adjusting gfc_match_rvalue in gcc/fortran/primary.cc. When a parameter list entry has a name, it is now preferred over the component name for matching, improving correctness for parameterized strings.

For Context
parameterized string
A string whose length or other properties are determined by parameters, often used in Fortran for flexibility.
gfc_match_rvalue
A function within the GCC Fortran front-end responsible for matching and processing rvalue expressions.
PR fortran/127146
A bug report filed against the GCC Fortran front-end, detailing issues with parameterized strings.
Filed Under: fortrancompiler