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

--- Comment #17 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:cdd1c90714c8c074e4cf65080a9e767ada13f29e

commit r15-11729-gcdd1c90714c8c074e4cf65080a9e767ada13f29e
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.

    (cherry picked from commit a88d82f24bdea7acdc0a6713baa805ae42e69dd1)

Reply via email to