Le 11/09/2026 à 20:57, Jerry D a écrit :
The attached patch is fairly straight forward. I had to add the missing optional keywords in a few places.

Regression tested on x85_64.

OK for trunk?

OK, thanks.

Regards,

Jerry

---

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.
---

Reply via email to