In gfc_conv_expr_descriptor, the code setting the descriptor cobounds (copied from the non-coarray case) has unnecessary stuff irrelevant to coarrays: as codimensions can't be transposed, the condition dim[n] == n is guaranteed to hold true for the codimensions. This patch removes unnecessary code based on that assumption.
OK?
2011-09-14 Mikael Morin <mikael.mo...@sfr.fr> * trans-array.c (gfc_conv_expr_descriptor): Simplify coarray descriptor setup code.
diff --git a/trans-array.c b/trans-array.c index 37cdeb5..88849ef 100644 --- a/trans-array.c +++ b/trans-array.c @@ -6140,22 +6140,13 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) for (n = ndim; n < ndim + codim; n++) { - /* look for the corresponding scalarizer dimension: dim. */ - for (dim = 0; dim < ndim + codim; dim++) - if (info->dim[dim] == n) - break; - - /* loop exited early: the DIM being looked for has been found. */ - gcc_assert (dim < ndim + codim); - - from = loop.from[dim]; - to = loop.to[dim]; + from = loop.from[n]; + to = loop.to[n]; gfc_conv_descriptor_lbound_set (&loop.pre, parm, - gfc_rank_cst[dim], from); + gfc_rank_cst[n], from); if (n < ndim + codim - 1) gfc_conv_descriptor_ubound_set (&loop.pre, parm, - gfc_rank_cst[dim], to); - dim++; + gfc_rank_cst[n], to); } if (se->data_not_needed)