https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89174
--- Comment #15 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Author: tkoenig Date: Sun Mar 3 10:09:32 2019 New Revision: 269351 URL: https://gcc.gnu.org/viewcvs?rev=269351&root=gcc&view=rev Log: 2019-03-03 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/89174 Backport from trunk * trans-expr.c (gfc_find_and_cut_at_last_class_ref): Add is_mold to garguments. If we are dealing with a MOLD, call gfc_expr_to_initialize(). * trans-stmt.c (gfc_trans_allocate): For MOLD, pass is_mold=true to gfc_find_and_cut_at_last_class_ref. * trans.h (gfc_find_and_cut_at_last_class_ref): Add optional argument is_mold with default false. 2019-03-03 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/89174 Backport from trunk * gfortran.dg/allocate_with_mold_3.f90: New test. Added: branches/gcc-8-branch/gcc/testsuite/gfortran.dg/allocate_with_mold_3.f90 Modified: branches/gcc-8-branch/gcc/fortran/ChangeLog branches/gcc-8-branch/gcc/fortran/trans-expr.c branches/gcc-8-branch/gcc/fortran/trans-stmt.c branches/gcc-8-branch/gcc/fortran/trans.h branches/gcc-8-branch/gcc/testsuite/ChangeLog