aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2015-02-05 08:02:58 +0000
committerPaul Thomas <pault@gcc.gnu.org>2015-02-05 08:02:58 +0000
commit3cd52c11b284c1123b1782dc5629d22a42844c37 (patch)
tree460ab48d46937485d07108170047c95303e18d38 /gcc/fortran/resolve.c
parenta0cbab4acd8f7af1ece6d94e61d5c754246c5efa (diff)
downloadgcc-3cd52c11b284c1123b1782dc5629d22a42844c37.zip
gcc-3cd52c11b284c1123b1782dc5629d22a42844c37.tar.gz
gcc-3cd52c11b284c1123b1782dc5629d22a42844c37.tar.bz2
2015-02-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/640757 * resolve.c (resolve_structure_cons): Obtain the rank of class components. * trans-expr.c (gfc_trans_alloc_subarray_assign): Do the assignment to allocatable class array components. (alloc_scalar_allocatable_for_subcomponent_assignment): If comp is a class component, allocate to the _data field. (gfc_trans_subcomponent_assign): If a class component with a derived type expression set the _vptr field and for array components, call gfc_trans_alloc_subarray_assign. For scalars, the assignment is performed here. 2015-02-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/640757 * gfortran.dg/type_to_class_2.f90: New test * gfortran.dg/type_to_class_3.f90: New test From-SVN: r220435
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index bb42404..3b0c12a 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1155,6 +1155,9 @@ resolve_structure_cons (gfc_expr *expr, int init)
}
rank = comp->as ? comp->as->rank : 0;
+ if (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->as)
+ rank = CLASS_DATA (comp)->as->rank;
+
if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank
&& (comp->attr.allocatable || cons->expr->rank))
{