diff options
author | Tobias Burnus <burnus@net-b.de> | 2015-03-21 09:29:40 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2015-03-21 09:29:40 +0100 |
commit | a684fb6488c58f91d57af7cc754ecbfb2806e731 (patch) | |
tree | 8866246c2d51904060ad5f01de69c89fd377f1b8 /gcc/fortran | |
parent | 506fdd17dd5635b6a920eb0391b2d01ed65beda4 (diff) | |
download | gcc-a684fb6488c58f91d57af7cc754ecbfb2806e731.zip gcc-a684fb6488c58f91d57af7cc754ecbfb2806e731.tar.gz gcc-a684fb6488c58f91d57af7cc754ecbfb2806e731.tar.bz2 |
trans-expr.c (gfc_get_tree_for_caf_expr): Reject unimplemented coindexed coarray accesses.
2015-03-21 Tobias Burnus <burnus@net-b.de>
* trans-expr.c (gfc_get_tree_for_caf_expr): Reject unimplemented
coindexed coarray accesses.
2015-03-21 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_38.f90: New.
* gfortran.dg/coarray_39.f90: New.
* gfortran.dg/coarray/coindexed_3.f90: Add dg-error, turn into
compile test.
From-SVN: r221549
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 57 |
2 files changed, 61 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 21a3b35..a53b5a8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-03-21 Tobias Burnus <burnus@net-b.de> + + * trans-expr.c (gfc_get_tree_for_caf_expr): Reject unimplemented + coindexed coarray accesses. + 2014-03-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/59198 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 8af8be2..fd3dd8c2 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1498,10 +1498,65 @@ gfc_get_tree_for_caf_expr (gfc_expr *expr) { tree caf_decl; bool found = false; - gfc_ref *ref; + gfc_ref *ref, *comp_ref = NULL; gcc_assert (expr && expr->expr_type == EXPR_VARIABLE); + /* Not-implemented diagnostic. */ + for (ref = expr->ref; ref; ref = ref->next) + if (ref->type == REF_COMPONENT) + { + comp_ref = ref; + if ((ref->u.c.component->ts.type == BT_CLASS + && !CLASS_DATA (ref->u.c.component)->attr.codimension + && (CLASS_DATA (ref->u.c.component)->attr.pointer + || CLASS_DATA (ref->u.c.component)->attr.allocatable)) + || (ref->u.c.component->ts.type != BT_CLASS + && !ref->u.c.component->attr.codimension + && (ref->u.c.component->attr.pointer + || ref->u.c.component->attr.allocatable))) + gfc_error ("Sorry, coindexed access to a pointer or allocatable " + "component of the coindexed coarray at %L is not yet " + "supported", &expr->where); + } + if ((!comp_ref + && ((expr->symtree->n.sym->ts.type == BT_CLASS + && CLASS_DATA (expr->symtree->n.sym)->attr.alloc_comp) + || (expr->symtree->n.sym->ts.type == BT_DERIVED + && expr->symtree->n.sym->ts.u.derived->attr.alloc_comp))) + || (comp_ref + && ((comp_ref->u.c.component->ts.type == BT_CLASS + && CLASS_DATA (comp_ref->u.c.component)->attr.alloc_comp) + || (comp_ref->u.c.component->ts.type == BT_DERIVED + && comp_ref->u.c.component->ts.u.derived->attr.alloc_comp)))) + gfc_error ("Sorry, coindexed coarray at %L with allocatable component is " + "not yet supported", &expr->where); + + if (expr->rank) + { + /* Without the new array descriptor, access like "caf[i]%a(:)%b" is in + general not possible as the required stride multiplier might be not + a multiple of c_sizeof(b). In case of noncoindexed access, the + scalarizer often takes care of it - for coarrays, it always fails. */ + for (ref = expr->ref; ref; ref = ref->next) + if (ref->type == REF_COMPONENT + && ((ref->u.c.component->ts.type == BT_CLASS + && CLASS_DATA (ref->u.c.component)->attr.codimension) + || (ref->u.c.component->ts.type != BT_CLASS + && ref->u.c.component->attr.codimension))) + break; + if (ref == NULL) + ref = expr->ref; + for ( ; ref; ref = ref->next) + if (ref->type == REF_ARRAY && ref->u.ar.dimen) + break; + for ( ; ref; ref = ref->next) + if (ref->type == REF_COMPONENT) + gfc_error ("Sorry, coindexed access at %L to a scalar component " + "with an array partref is not yet supported", + &expr->where); + } + caf_decl = expr->symtree->n.sym->backend_decl; gcc_assert (caf_decl); if (expr->symtree->n.sym->ts.type == BT_CLASS) |