aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-14 12:44:19 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-14 12:44:19 +0000
commit9a251aa11803ceed2c52286f2b649b4d53a05dba (patch)
tree8db602af3b13c045381240aefc6106c915111741 /gcc/fortran/trans-expr.c
parent9ef0c8d982bff201b518d99a900e7f7434ed33c9 (diff)
downloadgcc-9a251aa11803ceed2c52286f2b649b4d53a05dba.zip
gcc-9a251aa11803ceed2c52286f2b649b4d53a05dba.tar.gz
gcc-9a251aa11803ceed2c52286f2b649b4d53a05dba.tar.bz2
re PR fortran/32594 (substring simplification leads to ICE)
PR fortran/32594 * trans-expr.c (gfc_conv_substring_expr): Only call gfc_conv_substring if expr->ref is not NULL. * expr.c (gfc_is_constant_expr): If e->ref is NULL, the substring expression might be a constant. (gfc_simplify_expr): Handle missing start and end, as well as missing ref. * gfortran.dg/substr_5.f90: New test. From-SVN: r127478
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index d421a73..02bd91d 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -3243,14 +3243,15 @@ gfc_conv_substring_expr (gfc_se * se, gfc_expr * expr)
ref = expr->ref;
- gcc_assert (ref->type == REF_SUBSTRING);
+ gcc_assert (ref == NULL || ref->type == REF_SUBSTRING);
- se->expr = gfc_build_string_const(expr->value.character.length,
- expr->value.character.string);
+ se->expr = gfc_build_string_const (expr->value.character.length,
+ expr->value.character.string);
se->string_length = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (se->expr)));
- TYPE_STRING_FLAG (TREE_TYPE (se->expr))=1;
+ TYPE_STRING_FLAG (TREE_TYPE (se->expr)) = 1;
- gfc_conv_substring(se,ref,expr->ts.kind,NULL,&expr->where);
+ if (ref)
+ gfc_conv_substring (se, ref, expr->ts.kind, NULL, &expr->where);
}