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

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

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

commit r17-5555-ga88d82f24bdea7acdc0a6713baa805ae42e69dd1
Author: Harald Anlauf <[email protected]>
Date:   Sat Oct 24 15:46:33 2026 +0200

    fortran: Fix front-end memleaks while simplifying TRANSFER [PR127892]

    The rank of the result of TRANSFER can be 0 or 1.  Create the appropriate
    expression for array results directly, instead of a scalar constant
    expression and changing its type later, losing track of allocations of the
    value components.  Do not double-mpfr-initialize scalar integer, real, or
    complex value components.

            PR fortran/127892

    gcc/fortran/ChangeLog:

            * simplify.cc (gfc_simplify_transfer): Fix a GMP memleak.
            Reorganize the generation of the result expression so that its
            known rank is directly used.
            * target-memory.cc (gfc_target_interpret_expr): Use mpfr_clear /
            mpz_clear before reinitializing scalar numerical value components.

    gcc/testsuite/ChangeLog:

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

Reply via email to