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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Mikael Morin <[email protected]>:

https://gcc.gnu.org/g:0aff6f2c1b145e6d35b8ece3da4a7e32dfc74719

commit r17-4884-g0aff6f2c1b145e6d35b8ece3da4a7e32dfc74719
Author: Mikael Morin <[email protected]>
Date:   Mon Oct 5 11:31:33 2026 +0200

    fortran: Fix simply contiguous property for associate subrefs [PR127701]

    In the function implementing the simply contiguous property, fix the
    conditions governing the forwarding of the query from an associate name to
    its target.

    The query was forwarded to the associate target for any associate name
    reference that was a full array, which included the case of a full array
    component.  But a component may have different contiguous properties from
    the variable it's part of.  Supplement the check guarding the forwarding
    with an additional condition that the subreference walk before saw no
    component reference.

    The query was forwarded to the associate target only for a full reference
    to the associate name.  But a non-full simply-contiguous section reference
    of an associate name associated with a non-contiguous target is not simply
    contiguous.  Remove the condition on the full array reference from the
    check guarding the forwarding.

    With the condition on the full array reference removed, a non-contiguous
    array section of an associate name associated with a simply contiguous
    target should continue to return false.  Continue checking the array
    section even if the query forwarded to the associate target returned
    true.

            PR fortran/127701

    gcc/fortran/ChangeLog:

            * expr.cc (gfc_is_simply_contiguous): Only forward to the associate
            target if there is no subreference after the associate name.  Also
            forward to the associate target for a non-full array reference.
            Continue checking the array reference even if the associate target
            is simply contiguous.

    gcc/testsuite/ChangeLog:

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

Reply via email to