[Patch, fortran] [1/5] PR 45648: Inline transpose part 2: Support transposed descriptor whilst getting array bounds
Mikael Morin
mikael.morin@sfr.fr
Mon Sep 20 22:21:00 GMT 2010
We can't have dim (new descriptor's dimension) increasing together with n (original array's dimension) if we want to support transposed reference. We have to get dim such that info->dim[dim] == n. Then we can set the descriptor bounds along dim.
OK for trunk?
-------------- next part --------------
2010-09-20 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/45648
* trans-array.c (gfc_conv_expr_descriptor): Calculate dim out of n and
info->dim.
-------------- next part --------------
diff --git a/trans-array.c b/trans-array.c
index 7bce2ef..f15b53e 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -5439,7 +5439,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
}
offset = gfc_index_zero_node;
- dim = 0;
/* The following can be somewhat confusing. We have two
descriptors, a new one and the original array.
@@ -5479,9 +5478,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
}
else
{
- /* Check we haven't somehow got out of sync. */
- gcc_assert (info->dim[dim] == n);
-
/* Evaluate and remember the start of the section. */
start = info->start[n];
stride = gfc_evaluate_now (stride, &loop.pre);
@@ -5505,6 +5501,12 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Vector subscripts need copying and are handled elsewhere. */
if (info->ref)
gcc_assert (info->ref->u.ar.dimen_type[n] == DIMEN_RANGE);
+
+ /* look for the corresponding scalarizer dimension: dim. */
+ for (dim = 0; dim < ndim; dim++)
+ if (info->dim[dim] == n)
+ break;
+ gcc_assert (dim < ndim);
/* Set the new lower bound. */
from = loop.from[dim];
@@ -5559,8 +5561,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Store the new stride. */
gfc_conv_descriptor_stride_set (&loop.pre, parm,
gfc_rank_cst[dim], stride);
-
- dim++;
}
if (se->data_not_needed)
More information about the Fortran
mailing list