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

--- Comment #6 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:43c11931acc50f3a44efb485b03e6a8d44df97e0

commit r15-7789-g43c11931acc50f3a44efb485b03e6a8d44df97e0
Author: Andre Vehreschild <ve...@gcc.gnu.org>
Date:   Wed Feb 26 14:30:13 2025 +0100

    Fortran: Fix regression on double free on elemental function [PR118747]

    Fix a regression were adding a temporary variable inserted a copy of the
    argument to the elemental function.  That copy was then later used to
    free allocated memory, but the freeing was not tracked in the source
    array correctly.

            PR fortran/118747

    gcc/fortran/ChangeLog:

            * trans-array.cc (gfc_trans_array_ctor_element): Remove copy to
            temporary variable.
            * trans-expr.cc (gfc_conv_procedure_call): Use references to
            array members instead of copies when freeing after use.
            Formatting fix.

    gcc/testsuite/ChangeLog:

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

Reply via email to