Commit b1ccc24e by Jerry DeLisle

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
parent f89e2a3c
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> 2010-04-13 Iain Sandoe <iains@gcc.gnu.org>
PR bootstrap/31400 PR bootstrap/31400
......
...@@ -182,7 +182,7 @@ gfc_constructor_lookup (gfc_constructor_base base, int offset) ...@@ -182,7 +182,7 @@ gfc_constructor_lookup (gfc_constructor_base base, int offset)
if (node) if (node)
return (gfc_constructor*) node->value; 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. */ cover the offset looked for. */
node = splay_tree_predecessor (base, offset); node = splay_tree_predecessor (base, offset);
if (!node) if (!node)
......
...@@ -1332,6 +1332,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) ...@@ -1332,6 +1332,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
int rank; int rank;
int d; int d;
int shape_i; int shape_i;
int limit;
long unsigned one = 1; long unsigned one = 1;
bool incr_ctr; bool incr_ctr;
mpz_t start[GFC_MAX_DIMENSIONS]; mpz_t start[GFC_MAX_DIMENSIONS];
...@@ -1547,7 +1548,18 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) ...@@ -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); gcc_assert (cons);
gfc_constructor_append_expr (&expr->value.constructor, gfc_constructor_append_expr (&expr->value.constructor,
gfc_copy_expr (cons->expr), NULL); gfc_copy_expr (cons->expr), NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment