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

Fortran intrinsics NUM_IMAGES and IMAGE_INDEX now support TEAM_NUMBER keyword.

NUM_IMAGES and IMAGE_INDEX intrinsics in Fortran now correctly support the TEAM_NUMBER keyword for specifying teams in coarray operations.

This commit updates the Fortran compiler to correctly handle the TEAM_NUMBER keyword for the NUM_IMAGES and IMAGE_INDEX intrinsic procedures. Previously, these procedures shared a single dummy argument for team-related information, preventing the use of keywords for different team arguments and leading to incorrect behavior with certain standard versions. The change introduces separate, optional dummy arguments for TEAM (of type TEAM_TYPE) and TEAM_NUMBER (of type INTEGER), ensuring proper keyword support and diagnostics for Fortran 2018 coarray features.

In Details

The Fortran intrinsics NUM_IMAGES and IMAGE_INDEX previously had a single dummy argument team/team_number, hindering keyword usage and causing issues with Fortran 2008 standards. This patch in fortran/intrinsic.cc and related files introduces distinct optional dummy arguments: TEAM of type TEAM_TYPE and TEAM_NUMBER of type INTEGER. New checking functions (check_team_or_team_number) handle argument lists to correctly assign positional integer arguments to TEAM_NUMBER. Both arguments are now F2018 features, and the documentation and tests are updated accordingly.

For Context
NUM_IMAGES
A Fortran intrinsic function that returns the total number of images (processing units) in a specified team. It is part of the coarray programming model.
IMAGE_INDEX
A Fortran intrinsic function used in coarray programming. It returns the index of a specified image within a given team, or within the current team if none is specified.
TEAM
In Fortran coarray programming, a team is a collection of images that can perform parallel operations together. Teams allow for hierarchical parallel execution.
TEAM_NUMBER
An argument to Fortran coarray intrinsic procedures like NUM_IMAGES and IMAGE_INDEX, used to identify a specific team within which to query information.
intrinsic procedure
A built-in function or subroutine provided by the Fortran language that is available for use without explicit declaration.
Filed Under: fortrancompilercoarrayparallelism