https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87851
--- Comment #9 from anlauf at gcc dot gnu.org --- The following may be necessary in addition to the patch in comment#8: Index: gcc/fortran/simplify.c =================================================================== --- gcc/fortran/simplify.c (Revision 277298) +++ gcc/fortran/simplify.c (Arbeitskopie) @@ -4479,7 +4479,7 @@ gfc_simplify_len_trim (gfc_expr *e, gfc_expr *kind { gfc_expr *result; size_t count, len, i; - int k = get_kind (BT_INTEGER, kind, "LEN_TRIM", gfc_default_integer_kind); + int k = get_kind (BT_INTEGER, kind, "LEN_TRIM", gfc_charlen_int_kind); if (k == -1) return &gfc_bad_expr; I think the scalarizer issue mentioned in comment#1 is a separate issue.