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

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

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

commit r16-8905-gef03d3cfb45e0d75c137223c805ad75a3b7e319d
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