https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125690
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Paul Thomas <[email protected]>: https://gcc.gnu.org/g:9713ce4f550fdbc3bf23132bc208831a8d71d862 commit r17-4394-g9713ce4f550fdbc3bf23132bc208831a8d71d862 Author: Paul Thomas <[email protected]> Date: Wed Sep 16 16:50:27 2026 +0100 Fortran: Fix a number of issues with parameterized strings [PR125690] 2026-09-16 Paul Thomas <[email protected]> gcc/fortran PR fortran/125690 * decl.cc (gfc_get_pdt_instance): PDT strings with explicit array specifications are also PDT arrays. If the component is allocatable, the typespec must be marked deferred. * resolve.cc (resolve_structure_cons): Skip the string length check for PDT types. (resolve_allocate_expr): Initialize cmp to 0. Do not emit error if cmp = -3 since different variable could have the same value. * trans-array.cc (gfc_conv_scalarized_array_ref): Force pointer arithmetic by setting 'decl' for PDT strings. (gfc_conv_array_ref): Likewise. (structure_alloc_comps ): Move the declaraion of 'strlen' up. Evaluate the bounds and offset for pdt_strings as well as pdt arrays. If non-null, use strlen to obtain the size for malloc. Set the span to strlen. If the component type is a descriptor, rather than just a PDT array, use its data forboth the non-null condition and setting to null. * trans-io.cc (gfc_trans_transfer): PDT string arrays must be scalarized. gcc/testsuite PR fortran/125690 * gfortran.dg/pdt_95.f03: New test.
