https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83079
--- Comment #4 from anlauf at gcc dot gnu.org ---
The following patch fixes the testcase in comment#3:
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c (Revision 277989)
+++ gcc/fortran/trans-intrinsic.c (Arbeitskopie)
@@ -8410,7 +8410,11 @@
gfc_add_expr_to_block (&se->post, tmp);
se->expr = tmpdecl;
- se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len);
+ tmp = fold_convert (gfc_charlen_type_node,
+ TYPE_SIZE_UNIT (gfc_get_char_type (expr->ts.kind)));
+ se->string_length = fold_build2_loc (input_location, TRUNC_DIV_EXPR,
+ gfc_charlen_type_node,
+ dest_word_len, tmp);
}
else
{
I've tried to understand what happens when the MOLD argument is an array,
but got lost in mutually recursive functions in target-memory.c that seem
to try to convert char(kind=4) to default character, while I believe that
this should not happen. Don't really understand that code, giving up.