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

--- 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:0c3daf65d25db056f27981e309f574fae1ce6b9c

commit r17-6605-g0c3daf65d25db056f27981e309f574fae1ce6b9c
Author: Jerry DeLisle <[email protected]>
Date:   Sat Nov 21 18:16:06 2026 -0800

    fortran: [PR128936] LEN of a PDT character array component is scalar

    For a CHARACTER array component whose length is a LEN parameter,
    gfc_simplify_len replaced LEN (x%ch) by a reference to the parameter
    but kept the rank of the component, dropped the array reference of
    the base object and ignored KIND=.  An assignment of the result was
    rejected, LEN (y(2)%ch) hit an ICE, and KIND=8 gave a default
    integer.  Keep the array references of the base, resolve the new
    reference so that it becomes a scalar type parameter inquiry, and
    convert it to the requested kind.  reset_array_ref_to_scalar freed
    the end and stride of a section without clearing them, so y(2:3)%n
    freed them twice; clear them.

    Assisted-by: Claude Opus 5.5

            PR fortran/128936

    gcc/fortran/ChangeLog:

            * resolve.cc (reset_array_ref_to_scalar): Clear the end and stride
            after freeing them.
            * simplify.cc (gfc_simplify_len): Keep the array references of the
            base object for a LEN-parameter string component, resolve the
            result and convert it to the requested kind.

    gcc/testsuite/ChangeLog:

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

Reply via email to