Re: [patch] Bug 123772 - [OOP] Missed function result finalization when using defined assignment

Paul Richard Thomas <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <CAGkQGi+9t0sbMmtUphO9915aDW-zoUQH7A1=S4z+7MTz2mOKNg@mail.gmail.com>
Hi Andrew and Jerry,

The proposed patch is simple and works as intended. I was unable to
find a more elegant alternative.

OK to push.

Thanks for the patch.

Paul

On Sat, 24 Jan 2026 at 03:16, Jerry D <[email protected]> wrote:
>
> Hi all,
>
> The attached patch and new test case provided by Andrew Benson.
>
> Regression tested on x86_64-linux-gnu.
>
> OK for mainline?
>
> Date:   Fri Jan 23 18:52:34 2026 -0800
>
>      Fortran: Fix missed finalization
>
>              PR fortran/123772
>
>      gcc/fortran/ChangeLog:
>
>              * trans.cc: Add global variable is_assign_call.
>              (gfc_finalize_tree_expr): Derived type function results
>              with components that have defined assignements are
>              handled in resolve.cc(generate_component_assignments), unless
>              the assignment was replaced by a subroutine call to the
>              subroutine associated with the assignment operator.
>              (trans_code): In the case of EXEC_ASSIGN_CALL, set the
>              is_asign_call before calling gfc_trans_call, then clear it
>              after.
>
>      gcc/testsuite/ChangeLog:
>
>              * gfortran.dg/pr123772.f03: New test.
>
>              Signed off by: Andrew Benson <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.