summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-29 08:03:56 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-29 08:03:56 +0000
commita37bbfd1eaebb1ab018905a150f4a9f47fec4680 (patch)
tree5b5e361f6a06b4c347e6c6f865287c196fa1c6f0
parent6d0a4911f2a0d5f021e223462850837c7618452a (diff)
downloadppe42-gcc-a37bbfd1eaebb1ab018905a150f4a9f47fec4680.tar.gz
ppe42-gcc-a37bbfd1eaebb1ab018905a150f4a9f47fec4680.zip
* c-decl.c (grokdeclarator): Prevent crash in case of overflow in
array size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38526 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/c-decl.c7
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 20dd94cf3cc..04d22cd7324 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index f10f4b02b6a..92d84038ffd 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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. */
OpenPOWER on IntegriCloud