c-decl.c (grokdeclarator): Prevent crash in case of overflow in array size.

* c-decl.c (grokdeclarator): Prevent crash in case of overflow in
array size.

From-SVN: r38526
This commit is contained in:
Alexandre Oliva 2000-12-29 08:03:56 +00:00 committed by Alexandre Oliva
parent 7e7d951756
commit 6894017546
2 changed files with 9 additions and 1 deletions

View 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.

View 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);
/* 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. */