https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116669

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andre Vehreschild <ve...@gcc.gnu.org>:

https://gcc.gnu.org/g:d897090949086d1a094429f043a4dcb7bbc74448

commit r15-6615-gd897090949086d1a094429f043a4dcb7bbc74448
Author: Andre Vehreschild <ve...@gcc.gnu.org>
Date:   Mon Dec 9 14:56:27 2024 +0100

    Fortran: Extend cylic type detection for deallocate [PR116669]

    Using cycles in derived/class types lead to the compiler doing a endless
    recursion in several locations, when the cycle was not immediate.
    An immediate cyclic dependency is present in, for example T T::comp.
    Cylcic dependencies of the form T T2::comp; T2 T::comp2; are now
    detected and the recursive bit in the derived type's attr is set.

    gcc/fortran/ChangeLog:

            PR fortran/116669

            * class.cc (gfc_find_derived_vtab): Use attr to determine cyclic
            type dependendies.
            * expr.cc (gfc_has_default_initializer): Prevent endless
            recursion by storing already visited derived types.
            * resolve.cc (resolve_cyclic_derived_type): Determine if a type
            is used in its hierarchy in a cyclic way.
            (resolve_fl_derived0): Call resolve_cyclic_derived_type.
            (resolve_fl_derived): Ensure vtab is generated when cyclic
            derived types have allocatable components.
            * trans-array.cc (structure_alloc_comps): Prevent endless loop
            for derived type cycles.
            * trans-expr.cc (gfc_get_ultimate_alloc_ptr_comps_caf_token):
            Off topic, just prevent memory leaks.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/class_array_15.f03: Freeing more memory.
            * gfortran.dg/recursive_alloc_comp_6.f90: New test.
  • [Bug fortran/116669] compiler c... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to