OSDN Git Service

2010-04-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Apr 2010 05:16:59 +0000 (05:16 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:32:16 +0000 (14:32 +0900)
PR fortran/43747
* constructor.c: Fix typo in comment.
* expr.c (find_array_section): Add check for max array limit.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158290 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/constructor.c
gcc/fortran/expr.c

index e90da6f..7e0d91a 100644 (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
index d2789b1..12bbdc4 100644 (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)
index 03598c0..75f27be 100644 (file)
@@ -1518,7 +1518,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);