https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127702
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:bd2a164d7fdf1f109a8019aa2d32a2a2ad4893c4 commit r17-4848-gbd2a164d7fdf1f109a8019aa2d32a2a2ad4893c4 Author: Jerry DeLisle <[email protected]> Date: Sat Sep 19 12:24:05 2026 -0700 libgfortran: [PR127702] caf_shmem: do not take the size of a team from its barrier A team's image_count is the barrier its images synchronize in, and its count drops as images of the team terminate. It was also used as the number of images of the team, so NUM_IMAGES shrank once an image had stopped, IMAGE_STATUS reported an active image as stopped, and FORM TEAM and the collectives laid themselves out over too few images. Use the size of the team's image map, which does not change. Assisted-by: Claude Opus 5 PR libfortran/127702 libgfortran/ChangeLog: * caf/shmem.c (_gfortran_caf_num_images, _gfortran_caf_image_status) (_gfortran_caf_form_team): Take the size of a team from its image map. * caf/shmem/collective_subroutine.c (collsub_reduce_array): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/num_images_stopped_1.f90: New test.
