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

--- Comment #1 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:58786428fb320e235dfe0c60e2a40941f96f08e6

commit r17-6563-g58786428fb320e235dfe0c60e2a40941f96f08e6
Author: Jerry DeLisle <[email protected]>
Date:   Tue Nov 17 17:09:34 2026 -0800

    fortran: [PR128833] Segfault in derived-type assignment to a pointer

    When a component has a defined assignment whose first argument is
    INTENT(INOUT), or INTENT(OUT) and finalizable,
    generate_component_assignments first copies the lhs to a temporary.
    With a scalar pointer lhs the temporary became a pointer too, which
    nothing allocated, so the copy wrote through a null pointer.  Do not
    give a scalar temporary the POINTER attribute.

    Assisted-by: Claude Opus 5.5

            PR fortran/128833

    gcc/fortran/ChangeLog:

            * resolve.cc (generate_component_assignments): Do not give a scalar
            temporary for the lhs the POINTER attribute.

    gcc/testsuite/ChangeLog:

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

Reply via email to