diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-04-02 16:47:48 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-04-02 16:47:48 +0000 |
commit | 078c5aff5ed83e9c237f3090e947860314838e00 (patch) | |
tree | b81a2e4f6cf9728908b1970f8a5c4ef93655ee7b /gcc/fortran/decl.c | |
parent | c54a138f843e86571ff8a3ff29dbddf1d4489849 (diff) | |
download | gcc-078c5aff5ed83e9c237f3090e947860314838e00.zip gcc-078c5aff5ed83e9c237f3090e947860314838e00.tar.gz gcc-078c5aff5ed83e9c237f3090e947860314838e00.tar.bz2 |
re PR fortran/85102 (ICE in gfc_conv_intrinsic_dot_product, at fortran/trans-intrinsic.c:4464)
2018-04-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85102
* decl.c (variable_decl): If upper or lower bounds simplify
to a constant, use that.
2018-04-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85102
* gfortran.dg/array_simplify_2.f90: New test.
From-SVN: r259014
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index dce9dd2..192910d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2424,6 +2424,33 @@ variable_decl (int elem) goto cleanup; } } + if (as->type == AS_EXPLICIT) + { + for (int i = 0; i < as->rank; i++) + { + gfc_expr *e, *n; + e = as->lower[i]; + if (e->expr_type != EXPR_CONSTANT) + { + n = gfc_copy_expr (e); + gfc_simplify_expr (n, 1); + if (n->expr_type == EXPR_CONSTANT) + gfc_replace_expr (e, n); + else + gfc_free_expr (n); + } + e = as->upper[i]; + if (e->expr_type != EXPR_CONSTANT) + { + n = gfc_copy_expr (e); + gfc_simplify_expr (n, 1); + if (n->expr_type == EXPR_CONSTANT) + gfc_replace_expr (e, n); + else + gfc_free_expr (n); + } + } + } } char_len = NULL; |