diff options
Diffstat (limited to 'gcc/fortran/simplify.cc')
-rw-r--r-- | gcc/fortran/simplify.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f992c31..c0fbd0e 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -5895,6 +5895,7 @@ gfc_simplify_findloc (gfc_expr *array, gfc_expr *value, gfc_expr *dim, bool back_val = false; if (!is_constant_array_expr (array) + || array->shape == NULL || !gfc_is_constant_expr (dim)) return NULL; @@ -6431,7 +6432,7 @@ gfc_simplify_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector) /* Copy only those elements of ARRAY to RESULT whose MASK equals .TRUE.. */ mask_ctor = gfc_constructor_first (mask->value.constructor); - while (mask_ctor) + while (mask_ctor && array_ctor) { if (mask_ctor->expr->value.logical) { @@ -7536,8 +7537,9 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) } for (ref = array->ref; ref; ref = ref->next) - if (ref->type == REF_ARRAY && ref->u.ar.as) - gfc_resolve_array_spec (ref->u.ar.as, 0); + if (ref->type == REF_ARRAY && ref->u.ar.as + && !gfc_resolve_array_spec (ref->u.ar.as, 0)) + return NULL; if (dim == NULL) { |