aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2011-11-03 23:02:03 +0000
committerMikael Morin <mikael@gcc.gnu.org>2011-11-03 23:02:03 +0000
commitd35335e315c101657e9d735142ceff0daf6325fc (patch)
treec7940b9cad9dd6665eb13532c97f1a3787809c0c /gcc/fortran/trans-array.c
parent6adbe65465d0d065de0ab672991b849391e4a5eb (diff)
downloadgcc-d35335e315c101657e9d735142ceff0daf6325fc.zip
gcc-d35335e315c101657e9d735142ceff0daf6325fc.tar.gz
gcc-d35335e315c101657e9d735142ceff0daf6325fc.tar.bz2
trans-array.c (gfc_trans_create_temp_array): New variable total_dim.
* 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. From-SVN: r180887
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 01a411a..b2388c1 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -907,6 +907,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
tree cond;
tree or_expr;
int n, dim, tmp_dim;
+ int total_dim = 0;
memset (from, 0, sizeof (from));
memset (to, 0, sizeof (to));
@@ -919,6 +920,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
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++)
{
@@ -956,7 +958,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
/* 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;
@@ -985,8 +987,8 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
/* 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;
@@ -1009,7 +1011,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
}
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);