2016-10-25 Paul Thomas <pault@gcc.gnu.org>
commitdd7553fe99285c79e31d9300793cb23adf9eeb03
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Oct 2016 20:37:05 +0000 (25 20:37 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Oct 2016 20:37:05 +0000 (25 20:37 +0000)
tree33e3819d2249321176e33000909dc5e9aa0125fe
parentb95fe851a8791d1f0713ea98b52354e6dabc47f6
2016-10-25  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/45516
* class.c (gfc_find_derived_vtab): Detect recursive allocatable
derived type components. If present, add '_deallocate' field to
the vtable and build the '__deallocate' function.
* decl.c (build_struct): Allow recursive allocatable derived
type components for -std=f2008 or more.
(gfc_match_data_decl): Accept these derived types.
* expr.c (gfc_has_default_initializer): Ditto.
* resolve.c (resolve_component): Make sure that the vtable is
built for these derived types.
* trans-array.c(structure_alloc_comps) : Use the '__deallocate'
function for the automatic deallocation of these types.
* trans-expr.c : Generate the deallocate accessor.
* trans.h : Add its prototype.
* trans-types.c (gfc_get_derived_type): Treat the recursive
allocatable components in the same way as the corresponding
pointer components.

2016-10-25  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/45516
* gfortran.dg/class_2.f03: Set -std=f2003.
* gfortran.dg/finalize_21.f90: Modify tree-dump.
* gfortran.dg/recursive_alloc_comp_1.f08: New test.
* gfortran.dg/recursive_alloc_comp_2.f08: New test.
* gfortran.dg/recursive_alloc_comp_3.f08: New test.
* gfortran.dg/recursive_alloc_comp_4.f08: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241539 138bc75d-0d04-0410-961f-82ee72b054a4
14 files changed:
gcc/fortran/class.c
gcc/fortran/decl.c
gcc/fortran/expr.c
gcc/fortran/resolve.c
gcc/fortran/trans-array.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-types.c
gcc/fortran/trans.h
gcc/testsuite/gfortran.dg/class_2.f03
gcc/testsuite/gfortran.dg/finalize_21.f90
gcc/testsuite/gfortran.dg/recursive_alloc_comp_1.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/recursive_alloc_comp_2.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/recursive_alloc_comp_3.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/recursive_alloc_comp_4.f08 [new file with mode: 0644]