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) @@ -925,10 +925,18 @@ gfc_is_constant_expr (gfc_expr *e) /* 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)) + switch (e->value.function.isym->id) + { + case GFC_ISYM_IRAND: + case GFC_ISYM_RAND: + /* RNG functions are by definition not constant. */ return 0; - + default: + /* Check for constant arguments. */ + for (arg = e->value.function.actual; arg; arg = arg->next) + if (!gfc_is_constant_expr (arg->expr)) + return 0; + } return 1; } else 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,10 @@ 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, !(c->attr.pointer + || c->attr.proc_pointer + || c->attr.allocatable)) == FAILURE) + return FAILURE; } /* Resolve the type-bound procedures. */