From 9ebd7c3b978dba986c44cbc61f94cd97f381cc62 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Tue, 1 Apr 2025 12:17:43 +0200 Subject: Fortran: Add team-support to this_image [PR87326] This_image() no longer has a distance formal argument, but a team one. The source of the distance argument could not be identified, i.e. whether it came from a TS or standard draft. To implement only the standard it is removed. Besides being defined, it was not used anyway. PR fortran/87326 gcc/fortran/ChangeLog: * check.cc (gfc_check_this_image): Check the three different parameter lists possible for this_image and sort them correctly. * gfortran.texi: Update documentation on this_image's API. * intrinsic.cc (add_functions): Update this_image's signature. (check_specific): Add specific check for this_image. * intrinsic.h (gfc_check_this_image): Change to flexible argument list. * intrinsic.texi: Update documentation on this_image(). * iresolve.cc (gfc_resolve_this_image): Resolve the different arguments. * simplify.cc (gfc_simplify_this_image): Simplify the simplify routine. * trans-decl.cc (gfc_build_builtin_function_decls): Update signature of this_image. * trans-expr.cc (gfc_caf_get_image_index): Use correct signature of this_image. * trans-intrinsic.cc (trans_this_image): Adapt to correct signature. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_this_image): Correct prototype. * caf/single.c (struct caf_single_team): Add new_index of image. (_gfortran_caf_this_image): Return the image index in the given team. (_gfortran_caf_form_team): Set new_index in team structure. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_10.f90: Update error messages. * gfortran.dg/coarray_lib_this_image_1.f90: Same. * gfortran.dg/coarray_lib_this_image_2.f90: Same. * gfortran.dg/coarray_this_image_1.f90: Add more tests and remove incorrect ones. * gfortran.dg/coarray_this_image_2.f90: Test more features. * gfortran.dg/coarray_this_image_3.f90: New test. --- gcc/fortran/trans-expr.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/fortran/trans-expr.cc') diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 276f325..19e5669b 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -2579,10 +2579,8 @@ gfc_caf_get_image_index (stmtblock_t *block, gfc_expr *e, tree desc) gcc_assert (ref != NULL); if (ref->u.ar.dimen_type[ref->u.ar.dimen] == DIMEN_THIS_IMAGE) - { - return build_call_expr_loc (input_location, gfor_fndecl_caf_this_image, 1, - integer_zero_node); - } + return build_call_expr_loc (input_location, gfor_fndecl_caf_this_image, 1, + null_pointer_node); img_idx = build_zero_cst (gfc_array_index_type); extent = build_one_cst (gfc_array_index_type); -- cgit v1.1