https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126777
--- Comment #5 from Dan Bonachea <dobonachea at lbl dot gov> ---
Hi Jerry -
Thanks for your help with this!
Based on my testing the reported defects appear to be "half fixed".
Specifically, the compiler no longer ICEs on receiving a TEAM argument to
IMAGE_INDEX(), but the compiler still incorrectly rejects the
IMAGE_INDEX(TEAM=) and IMAGE_INDEX(TEAM_NUMBER=) argument keywords with a
compile error.
Demonstration (using the same original program):
cgpu$ cat image_index.F90
program test_image_index
use iso_fortran_env
implicit none
integer :: my_coarray[*]
integer :: res(3)
if (this_image() == 1) then
! image_index works without teams:
res(1) = image_index(my_coarray, [num_images()]) ! works
#if KEYWORD
! keyword arguments are not correctly implemented:
res(2) = image_index(my_coarray, [num_images()], TEAM=GET_TEAM()) ! missing
keyword
res(3) = image_index(my_coarray, [num_images()], TEAM_NUMBER=TEAM_NUMBER())
! missing keyword
#else
! omitting the keyword leads to a compiler crash in v16: (now fixed!)
res(2) = image_index(my_coarray, [num_images()], GET_TEAM())
res(3) = image_index(my_coarray, [num_images()], TEAM_NUMBER())
#endif
print *, "Total images running: ", num_images()
print *, "------------------------------------------------"
print *, "IMAGE_INDEX for cosubscript [", num_images(), "] : ", res
end if
end program test_image_index
cgpu$ /usr/local/pkg/gcc/17.20260906/bin/gfortran --version
GNU Fortran (GCC) 17.0.0 20260906 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cgpu$ /usr/local/pkg/gcc/17.20260906/bin/gfortran -fcoarray=lib -DKEYWORD=0
image_index.F90 -lcaf_shmem && ./a.out
Total images running: 4
------------------------------------------------
IMAGE_INDEX for cosubscript [ 4 ] : 4 4
4
cgpu$ /usr/local/pkg/gcc/17.20260906/bin/gfortran -fcoarray=lib -DKEYWORD=1
image_index.F90 -lcaf_shmem && ./a.out
image_index.F90:15:13:
15 | res(2) = image_index(my_coarray, [num_images()], TEAM=GET_TEAM()) !
missing keyword
| 1
Error: Cannot find keyword named 'team' in call to 'image_index' at (1)
image_index.F90:16:13:
16 | res(3) = image_index(my_coarray, [num_images()],
TEAM_NUMBER=TEAM_NUMBER()) ! missing keyword
| 1
Error: Cannot find keyword named 'team_number' in call to 'image_index' at (1)