https://gcc.gnu.org/g:ede3dd56e632457899a82049e298ddd0e3612e14

commit r16-7964-gede3dd56e632457899a82049e298ddd0e3612e14
Author: Andre Vehreschild <[email protected]>
Date:   Fri Jul 4 11:26:46 2025 +0200

    Fortran: Evaluate all functions on the source image.
    
    Formerly pure elemental functions were evaluated in the caf_accessor.
    This had so many dependencies that there was no benefit.  Evaluate
    every function on the calling side now, which has the benefit, that
    only one temporary has to be created instead of argument many.
    
            PR fortran/121043
    
    gcc/fortran/ChangeLog:
    
            * coarray.cc (check_add_new_component): Evaluate all functions
            on the source image.
            * trans-decl.cc (gfc_build_builtin_function_decls): The only
            argument of team_number() is of type void* in the library ABI.

Diff:
---
 gcc/fortran/coarray.cc    | 16 +++-------------
 gcc/fortran/trans-decl.cc |  7 +++----
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/gcc/fortran/coarray.cc b/gcc/fortran/coarray.cc
index ea56ab7de78b..18f4c29c1057 100644
--- a/gcc/fortran/coarray.cc
+++ b/gcc/fortran/coarray.cc
@@ -696,21 +696,11 @@ check_add_new_component (gfc_symbol *type, gfc_expr *e, 
gfc_symbol *add_data)
            check_add_new_component (type, actual->expr, add_data);
          break;
        case EXPR_FUNCTION:
-         if (!e->symtree->n.sym->attr.pure
-             && !e->symtree->n.sym->attr.elemental
-             && !(e->value.function.isym
-                  && (e->value.function.isym->pure
-                      || e->value.function.isym->elemental)))
-           /* Treat non-pure/non-elemental functions.  */
-           check_add_new_comp_handle_array (e, type, add_data);
-         else
-           for (gfc_actual_arglist *actual = e->value.function.actual; actual;
-                actual = actual->next)
-             check_add_new_component (type, actual->expr, add_data);
+         check_add_new_comp_handle_array (e, type, add_data);
          break;
        case EXPR_VARIABLE:
-           check_add_new_comp_handle_array (e, type, add_data);
-           break;
+         check_add_new_comp_handle_array (e, type, add_data);
+         break;
        case EXPR_ARRAY:
        case EXPR_PPC:
        case EXPR_STRUCTURE:
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index f80e72415775..4dfb390e4ebb 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -4312,10 +4312,9 @@ gfc_build_builtin_function_decls (void)
        get_identifier (PREFIX ("caf_sync_team")), ". r w w w ", void_type_node,
        4, pvoid_type_node, pint_type, pchar_type_node, size_type_node);
 
-      gfor_fndecl_caf_team_number
-       = gfc_build_library_function_decl_with_spec (
-           get_identifier (PREFIX("caf_team_number")), ". r ",
-           integer_type_node, 1, integer_type_node);
+      gfor_fndecl_caf_team_number = gfc_build_library_function_decl_with_spec (
+       get_identifier (PREFIX ("caf_team_number")), ". r ", integer_type_node,
+       1, pvoid_type_node);
 
       gfor_fndecl_caf_image_status = gfc_build_library_function_decl_with_spec 
(
        get_identifier (PREFIX ("caf_image_status")), ". r r ",

Reply via email to