diff options
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index aae1d72..08c2591 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3488,13 +3488,18 @@ static void gfc_conv_substring_expr (gfc_se * se, gfc_expr * expr) { gfc_ref *ref; + char *s; ref = expr->ref; gcc_assert (ref == NULL || ref->type == REF_SUBSTRING); - se->expr = gfc_build_string_const (expr->value.character.length, - expr->value.character.string); + gcc_assert (expr->ts.kind == gfc_default_character_kind); + s = gfc_widechar_to_char (expr->value.character.string, + expr->value.character.length); + se->expr = gfc_build_string_const (expr->value.character.length, s); + gfc_free (s); + se->string_length = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (se->expr))); TYPE_STRING_FLAG (TREE_TYPE (se->expr)) = 1; |