aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2018-06-21 17:34:31 +0000
committerPaul Thomas <pault@gcc.gnu.org>2018-06-21 17:34:31 +0000
commit75382a9665aa26d35ed2d5f18b2943223ab07b05 (patch)
treeb16d6362bc01c10d44f13604f3b352d4176cd089 /gcc/fortran/resolve.c
parent7792f13c845a8dc97e6b0a8023d81c67e8d650d2 (diff)
downloadgcc-75382a9665aa26d35ed2d5f18b2943223ab07b05.zip
gcc-75382a9665aa26d35ed2d5f18b2943223ab07b05.tar.gz
gcc-75382a9665aa26d35ed2d5f18b2943223ab07b05.tar.bz2
re PR fortran/83118 (Bad intrinsic assignment of class(*) array component of derived type)
2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/83118 * resolve.c (resolve_ordinary_assign): Force the creation of a vtable for assignment of non-polymorphic expressions to an unlimited polymorphic object. * trans-array.c (gfc_alloc_allocatable_for_assignment): Use the size of the rhs type for such assignments. Set the dtype, _len and vptrs appropriately. * trans-expr.c (gfc_trans_assignment): Force the use of the _copy function for these assignments. 2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/83118 * gfortran.dg/unlimited_polymorphic_30.f03: New test. From-SVN: r261857
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b1d4e03..1cc3165 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -10385,6 +10385,11 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
&& rhs->expr_type != EXPR_ARRAY)
gfc_add_data_component (rhs);
+ /* Make sure there is a vtable and, in particular, a _copy for the
+ rhs type. */
+ if (UNLIMITED_POLY (lhs) && lhs->rank && rhs->ts.type != BT_CLASS)
+ gfc_find_vtab (&rhs->ts);
+
bool caf_convert_to_send = flag_coarray == GFC_FCOARRAY_LIB
&& (lhs_coindexed
|| (code->expr2->expr_type == EXPR_FUNCTION