aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:49:09 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:49:09 -0700
commit3cb2c2fcdf3bd2f05afea27b6ccfb4734f6f88a0 (patch)
tree7b23a4dd9afa4e4cbfb0291b59f1ac462948b1aa /gcc
parentcb4b73da237153871fb840a3a31a79354933a8bb (diff)
downloadgcc-3cb2c2fcdf3bd2f05afea27b6ccfb4734f6f88a0.zip
gcc-3cb2c2fcdf3bd2f05afea27b6ccfb4734f6f88a0.tar.gz
gcc-3cb2c2fcdf3bd2f05afea27b6ccfb4734f6f88a0.tar.bz2
Revert "Fortran: Andre's tweak"
This reverts commit cb4b73da237153871fb840a3a31a79354933a8bb.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/coarray.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fortran/coarray.cc b/gcc/fortran/coarray.cc
index b3271e5..c611b53 100644
--- a/gcc/fortran/coarray.cc
+++ b/gcc/fortran/coarray.cc
@@ -696,6 +696,22 @@ 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))
+ {
+ /* Only allow pure and elemental function calls in a coarray
+ accessor, because all other may have side effects or access
+ pointers, which may not be possible in the accessor running on
+ another host. */
+ for (gfc_actual_arglist *actual = e->value.function.actual;
+ actual; actual = actual->next)
+ check_add_new_component (type, actual->expr, add_data);
+ }
+ else
+ /* Extract the expression, evaluate it and add a temporary with its
+ value to the helper structure. */
check_add_new_comp_handle_array (e, type, add_data);
break;
case EXPR_VARIABLE: