http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48360
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2011.04.08 04:16:46 Ever Confirmed|0 |1 --- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> 2011-04-08 04:16:46 UTC --- This is obviously mine :-) This fixes it but I suspect that a few more conditions (no ARRAY_ELEMENT for example) will be needed for it to be correct. Index: gcc/fortran/trans-array.c =================================================================== *** gcc/fortran/trans-array.c (revision 171573) --- gcc/fortran/trans-array.c (working copy) *************** get_std_lbound (gfc_expr *expr, tree des *** 6707,6712 **** --- 6707,6713 ---- tree stride; tree cond, cond1, cond3, cond4; tree tmp; + gfc_ref *ref; if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))) { tmp = gfc_rank_cst[dim]; *************** get_std_lbound (gfc_expr *expr, tree des *** 6740,6745 **** --- 6741,6752 ---- else if (expr->expr_type == EXPR_VARIABLE) { tmp = TREE_TYPE (expr->symtree->n.sym->backend_decl); + for (ref = expr->ref; ref; ref = ref->next) + { + if (ref->type == REF_COMPONENT + && ref->u.c.component->as) + tmp = TREE_TYPE (ref->u.c.component->backend_decl); + } return GFC_TYPE_ARRAY_LBOUND(tmp, dim); } else if (expr->expr_type == EXPR_FUNCTION) Paul