https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67818
--- Comment #9 from Mikael Morin <mikael at gcc dot gnu.org> --- Author: mikael Date: Sun Oct 18 15:01:03 2015 New Revision: 228945 URL: https://gcc.gnu.org/viewcvs?rev=228945&root=gcc&view=rev Log: PR fortran/67721 PR fortran/67818 Backport from mainline r222477: 2015-04-27 Andre Vehreschild <ve...@gmx.de> PR fortran/59678 PR fortran/65841 gcc/fortran/ * trans-array.c (duplicate_allocatable): Fixed deep copy of allocatable components, which are liable for copy only, when they are allocated. (gfc_duplicate_allocatable): Add deep-copy code into if component allocated block. Needed interface change for that. (gfc_copy_allocatable_data): Supplying NULL_TREE for code to add into if-block for checking whether a component was allocated. (gfc_duplicate_allocatable_nocopy): Likewise. (structure_alloc_comps): Likewise. * trans-array.h: Likewise. * trans-expr.c (gfc_trans_alloc_subarray_assign): Likewise. * trans-openmp.c (gfc_walk_alloc_comps): Likewise. gcc/testsuite/ * gfortran.dg/alloc_comp_deep_copy_1.f03: New test. * gfortran.dg/alloc_comp_deep_copy_2.f03: New test. Added: branches/gcc-5-branch/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_1.f03 branches/gcc-5-branch/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_2.f03 Modified: branches/gcc-5-branch/gcc/fortran/ChangeLog branches/gcc-5-branch/gcc/fortran/trans-array.c branches/gcc-5-branch/gcc/fortran/trans-array.h branches/gcc-5-branch/gcc/fortran/trans-expr.c branches/gcc-5-branch/gcc/fortran/trans-openmp.c branches/gcc-5-branch/gcc/testsuite/ChangeLog