This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR43747 [4.6 Regression] ICE in find_array_section, at fortran/expr.c:1551
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: gfortran list <fortran at gcc dot gnu dot org>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 13 Apr 2010 22:02:26 -0700
- Subject: [patch, fortran] PR43747 [4.6 Regression] ICE in find_array_section, at fortran/expr.c:1551
This patch turns out to be straight forward.
Regression tested on x86-64-linux-gnu:
Test case will be that of the PR.
OK for trunk?
Regards,
Jerry
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.
Index: constructor.c
===================================================================
--- constructor.c (revision 158253)
+++ constructor.c (working copy)
@@ -182,7 +182,7 @@ gfc_constructor_lookup (gfc_constructor_base base,
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)
Index: expr.c
===================================================================
--- expr.c (revision 158253)
+++ expr.c (working copy)
@@ -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);