aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-03-09 14:10:17 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-03-09 14:10:17 +0000
commit8ed5ae524ae350a50a82630342ef9578591090a5 (patch)
tree5378b67d3a528243b31abcd67acffdc1a2766a28 /gcc/fortran/decl.c
parent3568d2d5fa77f5c8798c1dca46b1f738d2097202 (diff)
downloadgcc-8ed5ae524ae350a50a82630342ef9578591090a5.zip
gcc-8ed5ae524ae350a50a82630342ef9578591090a5.tar.gz
gcc-8ed5ae524ae350a50a82630342ef9578591090a5.tar.bz2
re PR fortran/71203 (ICE in add_init_expr_to_sym, at fortran/decl.c:1512 and :1564)
2019-03-09 Thomas König <tkoenig@gcc.gnu.org> PR fortran/71203 * decl.c (add_init_expr_to_sym): Add shape if init has none. Add assert that it has to be an EXPR_ARRAY in this case. 2019-03-09 Thomas König <tkoenig@gcc.gnu.org> PR fortran/71203 * gfortran.dg/array_simplify_3.f90: New test case. From-SVN: r269526
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 3c8c5ff..31c7fb6 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1983,8 +1983,14 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
return false;
}
- /* Shape should be present, we get an initialization expression. */
- gcc_assert (init->shape);
+ /* The shape may be NULL for EXPR_ARRAY, set it. */
+ if (init->shape == NULL)
+ {
+ gcc_assert (init->expr_type == EXPR_ARRAY);
+ init->shape = gfc_get_shape (1);
+ if (!gfc_array_size (init, &init->shape[0]))
+ gfc_internal_error ("gfc_array_size failed");
+ }
for (dim = 0; dim < sym->as->rank; ++dim)
{