aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.cc
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2024-08-15 20:23:23 +0200
committerAndre Vehreschild <vehre@gcc.gnu.org>2024-08-19 11:15:13 +0200
commit8871489c5162067c72a9b9ab05fe2179560e9986 (patch)
tree8391af877e34399e9c641119184866dab17375fb /gcc/fortran/expr.cc
parent9cbcf8d1de159e6113fafb5dc2feb4a7e467a302 (diff)
downloadgcc-8871489c5162067c72a9b9ab05fe2179560e9986.zip
gcc-8871489c5162067c72a9b9ab05fe2179560e9986.tar.gz
gcc-8871489c5162067c72a9b9ab05fe2179560e9986.tar.bz2
Allow coarrays in select type. [PR46371, PR56496]
Fix ICE when scalar coarrays are used in a select type. Prevent coindexing in associate/select type/select rank selector expression. gcc/fortran/ChangeLog: PR fortran/46371 PR fortran/56496 * expr.cc (gfc_is_coindexed): Detect is coindexed also when rewritten to caf_get. * trans-stmt.cc (trans_associate_var): Always accept a descriptor for coarrays. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/select_type_1.f90: New test. * gfortran.dg/coarray/select_type_2.f90: New test. * gfortran.dg/coarray/select_type_3.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r--gcc/fortran/expr.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index d3a1f8c..4f2d80c 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -5803,6 +5803,10 @@ gfc_is_coindexed (gfc_expr *e)
{
gfc_ref *ref;
+ if (e->expr_type == EXPR_FUNCTION && e->value.function.isym
+ && e->value.function.isym->id == GFC_ISYM_CAF_GET)
+ e = e->value.function.actual->expr;
+
for (ref = e->ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
return !gfc_ref_this_image (ref);