GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
fortran

Fortran: Fix test cases related to PR103367

Follow-up Fortran commit corrects test cases for PR103367 concerning constant references.

This commit provides a follow-up fix for Fortran bug report PR103367 by adjusting related test cases. It modifies how constant references are simplified and how values are copied during array initializer conversions to ensure correctness and address issues identified in the original bug.

In Details

This patch addresses issues in the Fortran frontend related to constant references and array initializers, stemming from PR103367. It refactors simplify_const_ref in expr.cc to hoist a call to remove_subobject_ref, and modifies gfc_match_rvalue in primary.cc and gfc_conv_array_initializer in trans-array.cc to prevent unnecessary value copies when dealing with references or already-established variables, improving correctness in constant folding and array initialization.

For Context
PR103367
A Project/Problem Report number, indicating a bug filed in the GCC bug tracking system for the Fortran frontend.
Constant reference
In Fortran, a reference to a variable or expression that is known to be constant at compile time.
Array initializer
The syntax used in Fortran to provide initial values for array elements when the array is declared.
remove_subobject_ref
An internal Fortran compiler function likely used to remove redundant references to subobjects within a larger data structure.
Filed Under: fortranbugfixtesting