re PR fortran/43747 (ICE in find_array_section, at fortran/expr.c:1551)

2010-04-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/43747
	* constructor.c: Fix typo in comment.
	* expr.c (find_array_section): Add check for max array limit.

From-SVN: r158290
This commit is contained in:
Jerry DeLisle 2010-04-14 05:16:59 +00:00
parent f89e2a3c2c
commit b1ccc24ee2
3 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2010-04-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43747
* constructor.c: Fix typo in comment.
* expr.c (find_array_section): Add check for max array limit.
2010-04-13 Iain Sandoe <iains@gcc.gnu.org>
PR bootstrap/31400

View file

@ -182,7 +182,7 @@ gfc_constructor_lookup (gfc_constructor_base base, int offset)
if (node)
return (gfc_constructor*) node->value;
/* Check if the previous node as a repeat count big enough to
/* Check if the previous node has a repeat count big enough to
cover the offset looked for. */
node = splay_tree_predecessor (base, offset);
if (!node)

View file

@ -1332,6 +1332,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
int rank;
int d;
int shape_i;
int limit;
long unsigned one = 1;
bool incr_ctr;
mpz_t start[GFC_MAX_DIMENSIONS];
@ -1547,7 +1548,18 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
}
}
cons = gfc_constructor_lookup (base, mpz_get_ui (ptr));
limit = mpz_get_ui (ptr);
if (limit >= gfc_option.flag_max_array_constructor)
{
gfc_error ("The number of elements in the array constructor "
"at %L requires an increase of the allowed %d "
"upper limit. See -fmax-array-constructor "
"option", &expr->where,
gfc_option.flag_max_array_constructor);
return FAILURE;
}
cons = gfc_constructor_lookup (base, limit);
gcc_assert (cons);
gfc_constructor_append_expr (&expr->value.constructor,
gfc_copy_expr (cons->expr), NULL);