https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84546
--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> --- Author: pault Date: Wed May 16 09:35:19 2018 New Revision: 260281 URL: https://gcc.gnu.org/viewcvs?rev=260281&root=gcc&view=rev Log: 2018-05-16 Paul Thomas <pa...@gcc.gnu.org> PR fortran/84546 Backport from trunk * trans-array.c (structure_alloc_comps): Make sure that the vptr is copied and that the unlimited polymorphic _len is used to compute the size to be allocated. (build_array_ref): Set the 'unlimited' argument false in the call to gfc_get_class_array_ref. * trans-expr.c (gfc_get_class_array_ref): If unlimited, use the unlimited polymorphic _len for the offset to the element. (gfc_copy_class_to_class): Set the new 'unlimited' argument. * trans.h : Add the boolean 'unlimited' to the prototype. 2018-05-16 Paul Thomas <pa...@gcc.gnu.org> PR fortran/84546 Backport from trunk * gfortran.dg/unlimited_polymorphic_29.f90 : New test. Added: branches/gcc-7-branch/gcc/testsuite/gfortran.dg/unlimited_polymorphic_29.f90 Modified: branches/gcc-7-branch/gcc/fortran/ChangeLog branches/gcc-7-branch/gcc/fortran/trans-array.c branches/gcc-7-branch/gcc/fortran/trans-expr.c branches/gcc-7-branch/gcc/fortran/trans.h branches/gcc-7-branch/gcc/testsuite/ChangeLog