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

fortran: [PR127187] Type parameter inquiry selector is not a variable

Fixes incorrect handling of type parameter inquiries in Fortran associate names.

This commit addresses a bug in the Fortran compiler where type parameter inquiries, such as s%len or s%kind, were mistakenly treated as variables. This caused associate names to incorrectly point to the string length of s, leading to failures in certain test cases like associate_90.f90. The fix ensures these inquiries are correctly identified and not treated as variables, resolving the issue.

In Details

In gcc/fortran/resolve.cc, the resolve_assoc_var function incorrectly classified a selector that was a LEN or KIND type parameter inquiry (e.g., s%LEN or s%KIND) as a variable. This caused the associated name in a SELECT TYPE or similar construct to point to the character length of the selector's base object (s in this example) rather than the object itself. This change corrects the resolution logic, resolving PR127187 and preventing failures on targets where character length is implicitly an INTEGER type.

For Context
type parameter inquiry
In Fortran, a construct used to query the type parameters (like length or kind) of a declared variable or intrinsic type.
associate name
A name introduced in Fortran's ASSOCIATE construct that acts as an alias for an expression or variable within a specific scope.
PR127187
A bug report identifier. In this context, it refers to a specific issue filed against the Fortran frontend of GCC.
Filed Under: fortranbugfix