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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Harald Anlauf
<[email protected]>:

https://gcc.gnu.org/g:2acc6fd276b48579f712d1016519c0b2382a6aa6

commit r15-11177-g2acc6fd276b48579f712d1016519c0b2382a6aa6
Author: Harald Anlauf <[email protected]>
Date:   Thu May 7 22:34:52 2026 +0200

    Fortran: fix automatic deallocation with derived type IO
[PR111952,PR125059]

    The implementation of derived type IO wrongly forced allocatable instances
    of the DT as static, which prevented automatic deallocation of local
    variables.  The motivation was an attempt to prevent optimizations leading
    to certain testcase failures.  Howver, the underlying reason of the problem
    was a wrong fnspec of _gfortran_transfer_derived that declared the IO
    variable as being only read ('r').  Declare the corresponding parameter as
    being written ('w').

            PR fortran/111952
            PR fortran/125059

    gcc/fortran/ChangeLog:

            * trans-decl.cc (gfc_finish_var_decl): Remove bogus code forcing
            a DT variable with DTIO as static.
            * trans-io.cc (gfc_build_io_library_fndecls): Fix fnspec attribute.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/dtio_37.f90: New test.

    (cherry picked from commit 1904b9207203bbe45d6ce6a472d6a0c7e1bbd873)

Reply via email to