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

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

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

commit r17-2625-gf764d7111a29d8323e49a87a8321072295c73244
Author: Jerry DeLisle <[email protected]>
Date:   Tue Jul 21 09:15:50 2026 -0700

    fortran: [PR53296] Fix character array-ctor function called twice

    Avoid the redundant generated call to the pre chain when
    no_function_call is set.

    Also fix a related stack-buffer-overflow: gfc_conv_array_parameter
    wrote over the array constructor's. The specified length was to short.
    Use the explicit character type-spec length instead.

            PR fortran/53296

    gcc/fortran/ChangeLog:

            * trans-expr.cc (gfc_conv_procedure_call): Skip the redundant
            function call added to the pre chain when no_function_call is
            set and the character result length was already determined
            without running the callee.
            * trans-array.cc (gfc_conv_array_parameter): Convert an array
            constructor's explicit character type-spec length directly
            instead of using the first elements length.

    gcc/testsuite/ChangeLog:

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

Reply via email to