+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_create_temp_array): New variable total_dim.
+ Set total_dim to loop's rank. Replace usages of loop's rank.
+
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans-array.c (gfc_trans_array_constructor, trans_array_constructor):
tree cond;
tree or_expr;
int n, dim, tmp_dim;
+ int total_dim = 0;
memset (from, 0, sizeof (from));
memset (to, 0, sizeof (to));
if (gfc_option.warn_array_temp && where)
gfc_warning ("Creating array temporary at %L", where);
+ total_dim = loop->dimen;
/* Set the lower bound to zero. */
for (n = 0; n < loop->dimen; n++)
{
/* Initialize the descriptor. */
type =
- gfc_get_array_type_bounds (eltype, ss->dimen, 0, from, to, 1,
+ gfc_get_array_type_bounds (eltype, total_dim, 0, from, to, 1,
GFC_ARRAY_UNKNOWN, true);
desc = gfc_create_var (type, "atmp");
GFC_DECL_PACKED_ARRAY (desc) = 1;
/* If there is at least one null loop->to[n], it is a callee allocated
array. */
- for (n = 0; n < loop->dimen; n++)
- if (loop->to[n] == NULL_TREE)
+ for (n = 0; n < total_dim; n++)
+ if (to[n] == NULL_TREE)
{
size = NULL_TREE;
break;
}
else
{
- for (n = 0; n < loop->dimen; n++)
+ for (n = 0; n < total_dim; n++)
{
/* Store the stride and bound components in the descriptor. */
gfc_conv_descriptor_stride_set (pre, desc, gfc_rank_cst[n], size);