[Bug fortran/114021] ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer

"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=114021

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

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

commit r15-11479-gca85bd3e8a1f44ac61800e3f4ec4e93356e9065a
Author: Paul Thomas <[email protected]>
Date:   Fri Mar 27 10:50:39 2026 +0000

    Fortran: Fix ICE with allocation of scalar pointer entity [PR114021]

    2026-03-27  Paul Thomas  <[email protected]>

    gcc/fortran
            PR fortran/114021
            * symbol.cc (gfc_get_unique_symtree): If the namespace argument
            is NULL, allocate a new symtree and provide it with the unique
            name.
            * trans-expr.cc (trans_scalar_assign): In the deep copy of a
            derived type with allocatable components, fix the rhs value if
            it is not a constant or a variable.
            * trans-stmt.cc (gfc_trans_allocate): Do not deallocate
            allocatable components of a source that is not a variable and
            is a pointer. If the DECL_NAME or its IDENTIFIER_POINTER are
            null,use gfc_get_unique_symtree with NULL namespace to obtain a
            symtree for the assignment.

    gcc/testsuite/
            PR fortran/114021
            * gfortran.dg/pr114021.f90: New test.

    (cherry picked from commit e3cd8908019f4c023e6494fcd4a5acb60f98ed63)
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.