I plan to commit this fix from Christopher tonight. I will backport the fixes in a few days.

See details in the PR124751

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

commit ca704c44c3ffa8b456c9dccb7b854cda2aaafb3d (HEAD -> master)
Author: Christopher Albert <[email protected]>
Date:   Wed Apr 1 15:52:30 2026 +0200

    fortran: Fix assumed-rank repacking for contiguous dummies [PR124751]

    When an assumed-rank actual is packed for a contiguous dummy argument,
    create a descriptor for the packed temporary instead of reusing the
    original descriptor metadata with stale strides and offsets.

    The updated testcase keeps the original ICE coverage from PR100194 and
    adds runtime coverage for the remaining wrong-code cases reported after
    r16-8375.

            PR fortran/124751

    gcc/fortran/ChangeLog:

            * trans-array.cc (gfc_conv_array_parameter): Build a packed
            descriptor for assumed-rank actual arguments instead of reusing
            stale metadata from the original descriptor.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr100194.f90: Run the testcase and add runtime
            coverage for packed assumed-rank sections.

    Co-authored-by: Paul Thomas <[email protected]>
    Signed-off-by: Christopher Albert <[email protected]>

Reply via email to