[Bug fortran/121683] Data corruption with sourced allocation from constructor

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121683

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

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

commit r17-3385-gad78f61449bc9ef1d585e69ff48c46574f9a9382
Author: Paul Thomas <[email protected]>
Date:   Thu Aug 13 16:00:15 2026 +0100

    ortran: Fix data corruption with allocation from ctr source [P121683]

    2026-08-13  Paul Thomas  <[email protected]>

    gcc/fortran
            PR fortran/121683
            * trans-expr.cc (gfc_trans_subcomponent_assign): For derived
            type expressions assigned to a class or derived type component
            copy allocatable components if necessary. Likewise, for a class
            expression assigned to a scalar class component, allocate the
            component and use the vptr copy.

    gcc/testsuite/
            PR fortran/121683
            * gfortran.dg/structure_constructor_18.f90: New test
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.