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

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

commit r17-3649-g4aac44d03000635ccfd3138b5bd1a701db2c7825
Author: Jerry DeLisle <[email protected]>
Date:   Sun Aug 23 18:29:54 2026 -0700

    fortran: [PR49802]-4 Sequence association of a scalar actual with a VALUE
array dummy

    A scalar actual argument may be sequence associated with an
    explicit-shape array dummy (F2023, 15.5.2.12).  When that dummy has the
    VALUE attribute the scalar reached conv_dummy_value, which handles only
    scalar dummies, and gfortran ICEd.

    conv_seq_assoc_value_arg copies as many elements as the dummy declares
    into a temporary and passes that.  The element count comes from the
    bounds of the dummy, which may refer to other dummy arguments, so they
    are evaluated on the caller side through the interface mapping;
    gfc_conv_procedure_call now requests a mapping when any dummy is an
    explicit-shape VALUE array.  For a CHARACTER dummy the element sequence
    is grouped by the character length of the dummy, while the hidden
    length argument stays that of the actual argument, as it is for a dummy
    without VALUE.  A memcpy would leave the temporary sharing the actual
    argument's allocatable components, so those are given copies of their
    own and freed again after the call.

            PR fortran/49802

    gcc/fortran/ChangeLog:

            * trans-expr.cc (has_value_array_dummy): New function.
            (conv_seq_assoc_value_arg): New function.  Copy the element
            sequence declared by a VALUE array dummy when the actual argument
            is a sequence associated scalar.
            (gfc_conv_procedure_call): Request an interface mapping when a
            dummy is an explicit-shape VALUE array, and call
            conv_seq_assoc_value_arg for a scalar actual argument passed to a
            VALUE array dummy.

    gcc/testsuite/ChangeLog:

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

Reply via email to