trans-array.c (constant_array_constructor_loop_size): Handle multiple loops.
* trans-array.c (constant_array_constructor_loop_size): Handle multiple loops. From-SVN: r180901
This commit is contained in:
parent
b2f82aaa78
commit
f03077b019
|
@ -1,3 +1,8 @@
|
||||||
|
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
|
||||||
|
|
||||||
|
* trans-array.c (constant_array_constructor_loop_size):
|
||||||
|
Handle multiple loops.
|
||||||
|
|
||||||
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
|
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
|
||||||
|
|
||||||
* trans-array.c (get_rank, get_loop_upper_bound_for_array):
|
* trans-array.c (get_rank, get_loop_upper_bound_for_array):
|
||||||
|
|
|
@ -2053,12 +2053,17 @@ get_rank (gfc_loopinfo *loop)
|
||||||
iteration count of the loop if suitable, and NULL_TREE otherwise. */
|
iteration count of the loop if suitable, and NULL_TREE otherwise. */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
constant_array_constructor_loop_size (gfc_loopinfo * loop)
|
constant_array_constructor_loop_size (gfc_loopinfo * l)
|
||||||
{
|
{
|
||||||
|
gfc_loopinfo *loop;
|
||||||
tree size = gfc_index_one_node;
|
tree size = gfc_index_one_node;
|
||||||
tree tmp;
|
tree tmp;
|
||||||
int i;
|
int i, total_dim;
|
||||||
|
|
||||||
|
total_dim = get_rank (l);
|
||||||
|
|
||||||
|
for (loop = l; loop; loop = loop->parent)
|
||||||
|
{
|
||||||
for (i = 0; i < loop->dimen; i++)
|
for (i = 0; i < loop->dimen; i++)
|
||||||
{
|
{
|
||||||
/* If the bounds aren't constant, return NULL_TREE. */
|
/* If the bounds aren't constant, return NULL_TREE. */
|
||||||
|
@ -2067,7 +2072,7 @@ constant_array_constructor_loop_size (gfc_loopinfo * loop)
|
||||||
if (!integer_zerop (loop->from[i]))
|
if (!integer_zerop (loop->from[i]))
|
||||||
{
|
{
|
||||||
/* Only allow nonzero "from" in one-dimensional arrays. */
|
/* Only allow nonzero "from" in one-dimensional arrays. */
|
||||||
if (loop->dimen != 1)
|
if (total_dim != 1)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
tmp = fold_build2_loc (input_location, MINUS_EXPR,
|
tmp = fold_build2_loc (input_location, MINUS_EXPR,
|
||||||
gfc_array_index_type,
|
gfc_array_index_type,
|
||||||
|
@ -2075,10 +2080,11 @@ constant_array_constructor_loop_size (gfc_loopinfo * loop)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp = loop->to[i];
|
tmp = loop->to[i];
|
||||||
tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
|
tmp = fold_build2_loc (input_location, PLUS_EXPR,
|
||||||
tmp, gfc_index_one_node);
|
gfc_array_index_type, tmp, gfc_index_one_node);
|
||||||
size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
|
size = fold_build2_loc (input_location, MULT_EXPR,
|
||||||
size, tmp);
|
gfc_array_index_type, size, tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
|
Loading…
Reference in New Issue