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

Fortran: Preserve host association for dummy procedures.

Fixes Fortran resolution to correctly find optional dummy procedures in host scope.

This change corrects an issue in Fortran’s procedure resolution where a call statement incorrectly marked an unresolved procedure as a subroutine before its kind was known. By requiring a known procedure kind before treating the subroutine attribute as a declaration, the compiler now correctly finds optional dummy procedures in the host scope, resolving a bug in the handling of host association for dummy procedures.

In Details

The commit modifies resolve.cc (was_declared) to ensure that the subroutine attribute is only considered a declaration if the procedure's kind is known. Previously, an unresolved procedure was prematurely marked as a subroutine, preventing was_declared from correctly identifying optional dummy procedures within the host scope during resolution. This fix ensures correct host association for dummy procedures by delaying the declaration status until the procedure's type information is fully available.

For Context
host association
In Fortran, this refers to the mechanism by which entities declared in a containing scope (the 'host') are accessible within a nested scope, such as an internal procedure or a module procedure.
dummy procedure
In Fortran, a procedure that is passed as an argument to another procedure. It acts as a placeholder that can be invoked within the receiving procedure.
procedure kind
In Fortran, refers to the specific type of a procedure, such as 'subroutine' or 'function'. Distinguishing between these is crucial for correct resolution and invocation.
resolution
The process by which the compiler determines the meaning and identity of identifiers (like variable names or procedure names) within a program, including checking scopes and resolving ambiguities.
Filed Under: fortrancompiler bugsemantics