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

fortran: Fix ICE for IMAGE_INDEX with a TEAM argument [PR126777].

fortran: Fixes internal compiler error when using IMAGE_INDEX with a TEAM argument.

A Fortran compiler internal error (ICE) related to the IMAGE_INDEX intrinsic function when used with a TEAM argument has been fixed. The issue arose because the TEAM argument was incorrectly processed as a descriptor, leading to an assertion failure in walk_coarray. The fix changes the argument conversion to use gfc_conv_expr_val, aligning it with how trans_num_images and trans_this_image handle similar arguments. A new test case verifies this correction.

In Details

fortran: [PR126777] Fix ICE for IMAGE_INDEX with a TEAM argument This commit addresses an ICE in the Fortran front-end's coarray intrinsic translation pass, specifically within trans_image_index. The problem occurred when IMAGE_INDEX was called with a TEAM argument. The existing code used gfc_conv_expr_descriptor to translate this argument. However, gfc_conv_expr_descriptor is intended for arguments that are descriptors themselves, and it routes rank-0 expressions to walk_coarray, which then asserts. The correct translation for a TEAM argument, which is effectively a team ident…

For Context
ICE
Internal Compiler Error. An unexpected condition encountered by the compiler during the compilation process, usually indicating a bug in the compiler itself.
IMAGE_INDEX
A Fortran coarray intrinsic function that returns the index of a specified team within the current image.
TEAM
In Fortran coarrays, a 'team' represents a subset of images that can cooperate. Operations like FORM TEAM create new teams, and intrinsics like IMAGE_INDEX can operate on specific teams.
gfc_conv_expr_descriptor
A GCC Fortran front-end function responsible for converting an expression into a descriptor form. Descriptors typically hold information about data arrays, such as base address, shape, and strides.
gfc_conv_expr_val
A GCC Fortran front-end function used for converting expressions, particularly scalar values or identifiers, into a suitable representation for further processing or code generation.
walk_coarray
Likely a function or process within the GCC Fortran compiler's internal representation that handles the traversal and translation of coarray-related expressions.
PR126777
A problem report number in GCC's bug tracking system, indicating a specific issue that has been addressed by this commit.
Filed Under: fortrancompilerbugfixcoarrays