aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans.cc')
-rw-r--r--gcc/fortran/trans.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc
index d4c5409..ce46185 100644
--- a/gcc/fortran/trans.cc
+++ b/gcc/fortran/trans.cc
@@ -1404,11 +1404,12 @@ gfc_add_finalizer_call (stmtblock_t *block, gfc_expr *expr2,
ref->next = NULL;
}
- if (expr->ts.type == BT_CLASS
- && !expr2->rank
- && !expr2->ref
- && CLASS_DATA (expr2->symtree->n.sym)->as)
- expr->rank = CLASS_DATA (expr2->symtree->n.sym)->as->rank;
+ if (expr->ts.type == BT_CLASS && (!expr2->rank || !expr2->corank)
+ && !expr2->ref && CLASS_DATA (expr2->symtree->n.sym)->as)
+ {
+ expr->rank = CLASS_DATA (expr2->symtree->n.sym)->as->rank;
+ expr->corank = CLASS_DATA (expr2->symtree->n.sym)->as->corank;
+ }
stmtblock_t tmp_block;
gfc_start_block (&tmp_block);