https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126781
--- Comment #6 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:6e6249fc9e9932909089bc5b8cb3618650c9e662 commit r17-4204-g6e6249fc9e9932909089bc5b8cb3618650c9e662 Author: Jerry DeLisle <[email protected]> Date: Fri Sep 11 07:47:41 2026 -0700 fortran: [PR126781] TEAM_NUMBER keyword for NUM_IMAGES and IMAGE_INDEX The TEAM and TEAM_NUMBER arguments of NUM_IMAGES and IMAGE_INDEX shared a single dummy argument named "team/team_number", so neither keyword could be used, and the TEAM argument of IMAGE_INDEX was accepted with -std=f2008. Give each its own optional dummy argument, of type TEAM_TYPE and INTEGER. A positional INTEGER argument is moved to TEAM_NUMBER by the check functions, which now take the actual argument list, and giving both is diagnosed as an error. Both arguments are Fortran 2018. PR fortran/126781 gcc/fortran/ChangeLog: * check.cc (check_team_or_team_number): New function. (gfc_check_image_index, gfc_check_num_images): Take the actual argument list and use it. * intrinsic.cc (add_sym_2red, add_sym_4red): New functions. (add_functions): Give NUM_IMAGES and IMAGE_INDEX separate TEAM and TEAM_NUMBER arguments. (check_specific): Pass the actual argument list to gfc_check_num_images and gfc_check_image_index. * intrinsic.h (gfc_check_num_images, gfc_check_image_index, gfc_simplify_image_index, gfc_simplify_num_images, gfc_resolve_image_index): Update prototypes. * intrinsic.texi (IMAGE_INDEX, NUM_IMAGES): Document TEAM and TEAM_NUMBER as separate arguments. Fix the NUM_IMAGES example. * iresolve.cc (gfc_resolve_image_index): Add TEAM_NUMBER argument. * simplify.cc (gfc_simplify_num_images, gfc_simplify_image_index): Likewise. * trans-intrinsic.cc (trans_image_index, trans_num_images): Take the team number from the TEAM_NUMBER argument. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_this_image_3.f90: Update expected errors. * gfortran.dg/coarray/num_images_team_1.f90: New test. * gfortran.dg/coarray/num_images_team_2.f90: New test. * gfortran.dg/coarray_team_kw_1.f90: New test. * gfortran.dg/coarray_team_std_1.f90: New test.
