c-decl.c (grokdeclarator): Prevent crash in case of overflow in array size.
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 29 Dec 2000 08:03:56 +0000 (08:03 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 29 Dec 2000 08:03:56 +0000 (08:03 +0000)
* c-decl.c (grokdeclarator): Prevent crash in case of overflow in
array size.

From-SVN: r38526

gcc/ChangeLog
gcc/c-decl.c

index 20dd94c..04d22cd 100644 (file)
@@ -1,5 +1,8 @@
 2000-12-29  Alexandre Oliva  <aoliva@redhat.com>
 
+       * c-decl.c (grokdeclarator): Prevent crash in case of overflow in
+       array size.
+
        * calls.c (emit_library_call_value_1): Add to call_fusage the
        stack slot assigned to argument passed by reference.
 
index f10f4b0..92d8403 100644 (file)
@@ -4684,7 +4684,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
   if (TREE_CODE (type) == ARRAY_TYPE
       && COMPLETE_TYPE_P (type)
       && TREE_OVERFLOW (TYPE_SIZE (type)))
-    error ("size of array `%s' is too large", name);
+    {
+      error ("size of array `%s' is too large", name);
+      /* If we proceed with the array type as it is, we'll eventully
+        crash in tree_low_cst().  */
+      type = error_mark_node;
+    }
 
   /* If this is declaring a typedef name, return a TYPE_DECL.  */