[Bug fortran/126777] IMAGE_INDEX intrinsic incorrectly implements team forms
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 4 17:51:50 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126777
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:
https://gcc.gnu.org/g:d0e6302215241b785064f84959b3458bc1518b92
commit r17-3935-gd0e6302215241b785064f84959b3458bc1518b92
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date: Fri Aug 14 15:53:28 2026 -0700
fortran: [PR126777] Fix TEAM_NUMBER under -fcoarray=single and lib
Assisted-by: Claude Opus 5
Two pre-existing defects found while fixing PR126777.
conv_intrinsic_team_number returned the team handle itself as the team
number under -fcoarray=single. FORM TEAM is a no-op there and GET_TEAM()
folds to a null team_type, so the result was 0 rather than -1. Only the
initial team exists, so always return -1.
_gfortran_caf_team_number dereferenced its team handle unconditionally.
The front end passes a null handle for the no-argument form, meaning the
current team, so TEAM_NUMBER() segfaulted with -fcoarray=lib -lcaf_single.
Handle null as shmem.c already does.
intrinsic.texi documented IMAGE_INDEX as an inquiry function; it is
registered CLASS_TRANSFORMATIONAL, like NUM_IMAGES and THIS_IMAGE.
PR fortran/126777
gcc/fortran/ChangeLog:
* intrinsic.texi (IMAGE_INDEX): Document as a transformational
function, not an inquiry function.
* trans-intrinsic.cc (conv_intrinsic_team_number): Always return
-1 for -fcoarray=single, regardless of any TEAM argument.
libgfortran/ChangeLog:
* caf/single.c (_gfortran_caf_team_number): Treat a null team
handle as the current team.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/team_number_1.f90: New test.
More information about the Gcc-bugs
mailing list