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

--- Comment #4 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:d49facb09dfc467069b71a24b8a1de470dc472d1

commit r17-6520-gd49facb09dfc467069b71a24b8a1de470dc472d1
Author: Jerry DeLisle <[email protected]>
Date:   Sat Nov 7 18:14:31 2026 -0800

    fortran: [PR54322] Associate names are neither POINTER nor ALLOCATABLE

    An associate name has neither the POINTER nor the ALLOCATABLE attribute,
    and has the TARGET attribute only if the selector is a variable with the
    TARGET or POINTER attribute (F2023 11.1.3.3).  gfortran gave a
    polymorphic associate name the POINTER attribute of its class container,
    so it accepted pointer assignment to the associate name and, in a TYPE
    IS block, pointer assignment to it from a selector that was neither
    TARGET nor POINTER.

    Clear POINTER and ALLOCATABLE for an associate name other than that of
    SELECT RANK, and take TARGET from a SELECT TYPE selector rather than
    from the _data component that narrows it.  Two tests relied on the old
    behavior: associate_42.f90 pointer-assigned an associate name, and
    select_type_30.f03 passed one to a POINTER dummy without INTENT(IN).

    Assisted-by: Claude Opus 5.5

            PR fortran/54322

    gcc/fortran/ChangeLog:

            * primary.cc (gfc_variable_attr): Clear POINTER and ALLOCATABLE for
            an associate name, except for SELECT RANK.  Take TARGET from a
            SELECT TYPE selector rather than from its _data component.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/associate_42.f90: Pointer-assign the selector, not
            the associate name.
            * gfortran.dg/select_type_30.f03: Make the POINTER dummy
            INTENT(IN).
            * gfortran.dg/pr54322.f90: New test.
  • [Bug fortran/54322] [OOP] Wrong... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to