aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.cc
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2025-03-06 15:14:24 +0100
committerAndre Vehreschild <vehre@gcc.gnu.org>2025-03-12 14:34:39 +0100
commitbaa9b2b8d2eef7177118652d93ca0e7c933ba174 (patch)
tree05ee062e27555cf0f9628478ff6b092d7c5cd31d /gcc/fortran/expr.cc
parent52e297a3aa91ade5ee248fb728cf3b2f0ef320e7 (diff)
downloadgcc-baa9b2b8d2eef7177118652d93ca0e7c933ba174.zip
gcc-baa9b2b8d2eef7177118652d93ca0e7c933ba174.tar.gz
gcc-baa9b2b8d2eef7177118652d93ca0e7c933ba174.tar.bz2
Fortran: Add F2018 TEAM_NUMBER to coindexed expressions [PR98903]
Add missing parsing and code generation for a[..., TEAM_NUMBER=...] as defined from F2015 onwards. Because F2015 is not used as dedicated standard in GFortran add it to the F2018 standard feature set. PR fortran/98903 gcc/fortran/ChangeLog: * array.cc (gfc_copy_array_ref): Copy team, team_type and stat. (match_team_or_stat): Match a single team(_number)= or stat=. (gfc_match_array_ref): Add switching to image_selector_parsing and error handling when indices come after named arguments. * coarray.cc (move_coarray_ref): Move also team_type. * expr.cc (gfc_free_ref_list): Free team and stat expression. (gfc_find_team_co): Find team or team_number in array-ref. * gfortran.h (enum gfc_array_ref_team_type): New enum to distinguish unset, team or team_number expression. (gfc_find_team_co): Default searching to team= expressions. * resolve.cc (resolve_array_ref): Check for type correctness of team(_number) and stats in coindices. * trans-array.cc (gfc_conv_array_ref): Ensure stat is cleared when fcoarray=single is used. * trans-intrinsic.cc (conv_stat_and_team): Including team_number in conversion. (gfc_conv_intrinsic_caf_get): Propagate team_number to ABI routine. (conv_caf_send_to_remote): Same. (conv_caf_sendget): Same. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/coindexed_2.f90: New test. * gfortran.dg/coarray/coindexed_3.f08: New test. * gfortran.dg/coarray/coindexed_4.f08: New test.
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r--gcc/fortran/expr.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index e4ab3ba..9d84e76 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -629,6 +629,8 @@ gfc_free_ref_list (gfc_ref *p)
gfc_free_expr (p->u.ar.stride[i]);
}
+ gfc_free_expr (p->u.ar.stat);
+ gfc_free_expr (p->u.ar.team);
break;
case REF_SUBSTRING:
@@ -5840,18 +5842,20 @@ gfc_ref_this_image (gfc_ref *ref)
}
gfc_expr *
-gfc_find_team_co (gfc_expr *e)
+gfc_find_team_co (gfc_expr *e, enum gfc_array_ref_team_type req_team_type)
{
gfc_ref *ref;
for (ref = e->ref; ref; ref = ref->next)
- if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
+ if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0
+ && ref->u.ar.team_type == req_team_type)
return ref->u.ar.team;
- if (e->value.function.actual->expr)
+ if (e->expr_type == EXPR_FUNCTION && e->value.function.actual->expr)
for (ref = e->value.function.actual->expr->ref; ref;
ref = ref->next)
- if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
+ if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0
+ && ref->u.ar.team_type == req_team_type)
return ref->u.ar.team;
return NULL;