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

--- Comment #2 from anlauf at gcc dot gnu.org ---
This fixes the issue here:

diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index a9e512ed135..9f219987ee0 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1135,6 +1135,7 @@ gfc_init_types (void)
     {
       type = gfc_build_uint_type (gfc_character_kinds[index].bit_size);
       type = build_qualified_type (type, TYPE_UNQUALIFIED);
+      TYPE_STRING_FLAG (type) = 1;
       snprintf (name_buf, sizeof(name_buf), "character(kind=%d)",
                gfc_character_kinds[index].kind);
       PUSH_TYPE (name_buf, type);

Otherwise get_array_span handles character(kind=4) deferred length wrong here.

Reply via email to