From a9a5a41415bca8c0bc6c6e13dd9f7f2279fb4edf Mon Sep 17 00:00:00 2001 From: mikael Date: Thu, 3 Nov 2011 23:25:34 +0000 Subject: [PATCH] * trans-array.c (gfc_trans_array_constructor): Loop over the parents. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180891 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/trans-array.c | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7595d35..196f3da 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,9 @@ 2011-11-03 Mikael Morin + * trans-array.c (gfc_trans_array_constructor): Loop over the parents. + +2011-11-03 Mikael Morin + * trans-array.c (gfc_set_loop_bounds_from_array_spec): Loop over the parents. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 83542f6..463a0a2 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1953,6 +1953,7 @@ trans_constant_array_constructor (gfc_ss * ss, tree type) } } + /* Helper routine of gfc_trans_array_constructor to determine if the bounds of the loop specified by LOOP are constant and simple enough to use with trans_constant_array_constructor. Returns the @@ -2010,6 +2011,7 @@ trans_array_constructor (gfc_ss * ss, locus * where) gfc_loopinfo *loop; gfc_ss_info *ss_info; gfc_expr *expr; + gfc_ss *s; /* Save the old values for nested checking. */ old_first_len = first_len; @@ -2078,16 +2080,20 @@ trans_array_constructor (gfc_ss * ss, locus * where) if (expr->shape && loop->dimen > 1 && loop->to[0] == NULL_TREE) { /* We have a multidimensional parameter. */ - int n; - for (n = 0; n < expr->rank; n++) - { - loop->from[n] = gfc_index_zero_node; - loop->to[n] = gfc_conv_mpz_to_tree (expr->shape [n], - gfc_index_integer_kind); - loop->to[n] = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, - loop->to[n], gfc_index_one_node); - } + for (s = ss; s; s = s->parent) + { + int n; + for (n = 0; n < s->loop->dimen; n++) + { + s->loop->from[n] = gfc_index_zero_node; + s->loop->to[n] = gfc_conv_mpz_to_tree (expr->shape[s->dim[n]], + gfc_index_integer_kind); + s->loop->to[n] = fold_build2_loc (input_location, MINUS_EXPR, + gfc_array_index_type, + s->loop->to[n], + gfc_index_one_node); + } + } } if (loop->to[0] == NULL_TREE) -- 2.7.4