There are two functions checking that an expression is a coarray. This keeps the public one (which seems to be the more complete) and removes the other one.
OK? PS: As this changes a rejects-valid into an ice-on-valid (see PR 50420 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50420), it can be delayed if preferred; unfortunately, patch 14 fails without this one.
2011-09-14 Mikael Morin <mikael.mo...@sfr.fr> * check.c (is_coarray): Remove. (coarray_check): Use gfc_is_coarray.
diff --git a/check.c b/check.c index 3d4f4c8..81f7b30 100644 --- a/check.c +++ b/check.c @@ -203,42 +203,10 @@ double_check (gfc_expr *d, int n) } -/* Check whether an expression is a coarray (without array designator). */ - -static bool -is_coarray (gfc_expr *e) -{ - bool coarray = false; - gfc_ref *ref; - - if (e->expr_type != EXPR_VARIABLE) - return false; - - coarray = e->symtree->n.sym->attr.codimension; - - for (ref = e->ref; ref; ref = ref->next) - { - if (ref->type == REF_COMPONENT) - coarray = ref->u.c.component->attr.codimension; - else if (ref->type != REF_ARRAY || ref->u.ar.dimen != 0) - coarray = false; - else if (ref->type == REF_ARRAY && ref->u.ar.codimen != 0) - { - int n; - for (n = 0; n < ref->u.ar.codimen; n++) - if (ref->u.ar.dimen_type[n] != DIMEN_THIS_IMAGE) - coarray = false; - } - } - - return coarray; -} - - static gfc_try coarray_check (gfc_expr *e, int n) { - if (!is_coarray (e)) + if (!gfc_is_coarray (e)) { gfc_error ("Expected coarray variable as '%s' argument to the %s " "intrinsic at %L", gfc_current_intrinsic_arg[n]->name,