Index: gcc/fortran/array.c =================================================================== --- gcc/fortran/array.c (revision 162282) +++ gcc/fortran/array.c (working copy) @@ -302,8 +302,7 @@ resolve_array_bound (gfc_expr *e, int check_consta if (check_constant && gfc_is_constant_expr (e) == 0) { - gfc_error ("Variable '%s' at %L in this context must be constant", - e->symtree->n.sym->name, &e->where); + gfc_error ("Array bound at %L must be constant", &e->where); return FAILURE; } Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 162282) +++ gcc/fortran/expr.c (working copy) @@ -868,39 +868,14 @@ done: } -static match -check_specification_function (gfc_expr *e) -{ - gfc_symbol *sym; - - if (!e->symtree) - return MATCH_NO; - - sym = e->symtree->n.sym; - - /* F95, 7.1.6.2; F2003, 7.1.7 */ - if (sym - && sym->attr.function - && sym->attr.pure - && !sym->attr.intrinsic - && !sym->attr.recursive - && sym->attr.proc != PROC_INTERNAL - && sym->attr.proc != PROC_ST_FUNCTION - && sym->attr.proc != PROC_UNKNOWN - && sym->formal == NULL) - return MATCH_YES; - - return MATCH_NO; -} - /* Function to determine if an expression is constant or not. This - function expects that the expression has already been simplified. */ + function expects that the expression has already been simplified. + Cf. F08, chapter 7.1.12. */ int gfc_is_constant_expr (gfc_expr *e) { gfc_constructor *c; - gfc_actual_arglist *arg; if (e == NULL) return 1; @@ -913,27 +888,11 @@ gfc_is_constant_expr (gfc_expr *e) || gfc_is_constant_expr (e->value.op.op2))); case EXPR_VARIABLE: - return 0; - case EXPR_FUNCTION: case EXPR_PPC: case EXPR_COMPCALL: - /* Specification functions are constant. */ - if (check_specification_function (e) == MATCH_YES) - return 1; + return 0; - /* Call to intrinsic with at least one argument. */ - if (e->value.function.isym && e->value.function.actual) - { - for (arg = e->value.function.actual; arg; arg = arg->next) - if (!gfc_is_constant_expr (arg->expr)) - return 0; - - return 1; - } - else - return 0; - case EXPR_CONSTANT: case EXPR_NULL: return 1; Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 162282) +++ gcc/fortran/resolve.c (working copy) @@ -10733,7 +10733,6 @@ resolve_fl_derived (gfc_symbol *sym) { gfc_symbol* super_type; gfc_component *c; - int i; super_type = gfc_get_derived_super_type (sym); @@ -11089,25 +11088,8 @@ resolve_fl_derived (gfc_symbol *sym) && sym != c->ts.u.derived) add_dt_to_dt_list (c->ts.u.derived); - if (c->attr.pointer || c->attr.proc_pointer || c->attr.allocatable - || c->as == NULL) - continue; - - for (i = 0; i < c->as->rank; i++) - { - if (c->as->lower[i] == NULL - || (resolve_index_expr (c->as->lower[i]) == FAILURE) - || !gfc_is_constant_expr (c->as->lower[i]) - || c->as->upper[i] == NULL - || (resolve_index_expr (c->as->upper[i]) == FAILURE) - || !gfc_is_constant_expr (c->as->upper[i])) - { - gfc_error ("Component '%s' of '%s' at %L must have " - "constant array bounds", - c->name, sym->name, &c->loc); - return FAILURE; - } - } + if (gfc_resolve_array_spec (c->as, false) == FAILURE) + return FAILURE; } /* Resolve the type-bound procedures. */