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

Fortran CHARACTER TARGET dummy with vector subscript now uses temporary.

Fixes ICE in Fortran compiler for CHARACTER TARGET dummies with vector subscripts by creating a temporary.

The Fortran compiler previously failed with an ICE when trying to describe a CHARACTER subreference array with a vector subscript. This was because the existing descriptor logic could not handle vector subscripts and would assert. The fix ensures a temporary is created for expressions with a vector subscript, resolving the compiler error.

In Details

In gcc/fortran/trans-array.cc, the gfc_conv_expr_descriptor function previously attempted to describe CHARACTER subreferences, including those with vector subscripts, using a descriptor. This commit modifies the logic to prevent treating expressions with vector subscripts as subreference array targets, instead forcing the creation of a temporary. This addresses an ICE related to CHARACTER TARGET dummy arguments and assumed-shape arrays.

For Context
ICE
Internal Compiler Error, a fatal error indicating a bug within the compiler itself.
CHARACTER TARGET
In Fortran, a dummy argument declared with CHARACTER and TARGET attribute. It represents a character entity that can be passed by reference.
vector subscript
A subscript in Fortran that is itself an array, used to select a subset of elements from a higher-dimensional array.
descriptor
A data structure used by the compiler to describe properties of an array or character string, such as its base address, shape, and element size.
Filed Under: fortrancompiler-bug