re PR fortran/77703 (ICE on assignment to pointer function)
[gcc.git] / gcc / fortran / resolve.c
index 9ce01c7dd4280a89628f04f0b0dbfd23278cc70d..ec8070ffc8daf865cb98b07bac9393d62ad4b6ce 100644 (file)
@@ -10637,6 +10637,11 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
   gfc_get_sym_tree (name, ns, &tmp, false);
   gfc_add_type (tmp->n.sym, &e->ts, NULL);
 
+  if (e->expr_type == EXPR_CONSTANT && e->ts.type == BT_CHARACTER)
+    tmp->n.sym->ts.u.cl->length = gfc_get_int_expr (gfc_charlen_int_kind,
+                                                   NULL,
+                                                   e->value.character.length);
+
   as = NULL;
   ref = NULL;
   aref = NULL;