aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2016-11-05 07:11:24 +0000
committerPaul Thomas <pault@gcc.gnu.org>2016-11-05 07:11:24 +0000
commitd233ee5f50926d58da601e4f8633d98632ced3d2 (patch)
treefcf8b51f76ca765ffff8c3d6689854e1dc684506 /gcc/fortran/trans-expr.c
parent655a8355666bc3a238e6461409995f30817aff67 (diff)
downloadgcc-d233ee5f50926d58da601e4f8633d98632ced3d2.zip
gcc-d233ee5f50926d58da601e4f8633d98632ced3d2.tar.gz
gcc-d233ee5f50926d58da601e4f8633d98632ced3d2.tar.bz2
re PR fortran/67564 (Segfault on sourced allocattion statement with class(*) arrays)
2016-11-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/67564 * trans-expr.c (gfc_conv_class_to_class): Return _len component of unlimited polymorphic entities. 2016-11-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/67564 * gfortran.dg/select_type_39.f03: New test. From-SVN: r241869
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 7159b17..309f502 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1091,6 +1091,12 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
tmp = integer_zero_node;
gfc_add_modify (&parmse->pre, ctree,
fold_convert (TREE_TYPE (ctree), tmp));
+
+ /* Return the len component, except in the case of scalarized array
+ references, where the dynamic type cannot change. */
+ if (!elemental && full_array && copyback)
+ gfc_add_modify (&parmse->post, tmp,
+ fold_convert (TREE_TYPE (tmp), ctree));
}
if (optional)