diff options
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index f3c367c..d8ae04f 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4309,7 +4309,11 @@ gfc_get_corank (gfc_expr *e) if (!gfc_is_coarray (e)) return 0; - corank = e->symtree->n.sym->as ? e->symtree->n.sym->as->corank : 0; + if (e->ts.type == BT_CLASS && e->ts.u.derived->components) + corank = e->ts.u.derived->components->as + ? e->ts.u.derived->components->as->corank : 0; + else + corank = e->symtree->n.sym->as ? e->symtree->n.sym->as->corank : 0; for (ref = e->ref; ref; ref = ref->next) { @@ -4394,6 +4398,7 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict) int i; gfc_array_ref *ar = NULL; gfc_ref *ref, *part_ref = NULL; + gfc_symbol *sym; if (expr->expr_type == EXPR_FUNCTION) return expr->value.function.esym @@ -4417,11 +4422,15 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict) ar = &ref->u.ar; } - if ((part_ref && !part_ref->u.c.component->attr.contiguous - && part_ref->u.c.component->attr.pointer) - || (!part_ref && !expr->symtree->n.sym->attr.contiguous - && (expr->symtree->n.sym->attr.pointer - || expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE))) + sym = expr->symtree->n.sym; + if (expr->ts.type != BT_CLASS + && ((part_ref + && !part_ref->u.c.component->attr.contiguous + && part_ref->u.c.component->attr.pointer) + || (!part_ref + && !sym->attr.contiguous + && (sym->attr.pointer + || sym->as->type == AS_ASSUMED_SHAPE)))) return false; if (!ar || ar->type == AR_FULL) |