2012-09-07 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/54208
* simplify.c (simplify_bound_dim): Resolve array spec before
proceeding with simplification.
2012-09-07 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/54208
* gfortran.dg/bound_simplification_3.f90: New test.
===================================================================
@@ -3255,6 +3255,9 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kin
gcc_assert (array->expr_type == EXPR_VARIABLE);
gcc_assert (as);
+ if (gfc_resolve_array_spec (as, 0) == FAILURE)
+ return NULL;
+
/* The last dimension of an assumed-size array is special. */
if ((!coarray && d == as->rank && as->type == AS_ASSUMED_SIZE && !upper)
|| (coarray && d == as->rank + as->corank