summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-20 00:58:35 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-20 00:58:35 +0000
commitee5b587b08017b607e981ac30751b81d9ec7e15e (patch)
tree26999095bf77649f560d24d3823ee28f35530487
parentbda5dc01636127eedea92299139c2c53dc7b899d (diff)
downloadgcc-ee5b587b08017b607e981ac30751b81d9ec7e15e.tar.gz
Fix tree-checking abort on testcase with undefined macro as array size.
* c-decl.c (start_decl): Check for error_mark_node type before using COMPLETE_TYPE_P. (finish_decl): Likewise. Don't give an error if decl type is already error_mark_node. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36955 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-decl.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5fa663e4111..51ac0678685 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2000-10-19 Jim Wilson <wilson@cygnus.com>
+ * c-decl.c (start_decl): Check for error_mark_node type before using
+ COMPLETE_TYPE_P.
+ (finish_decl): Likewise. Don't give an error if decl type is
+ already error_mark_node.
+
* haifa-sched.c (compute_trg_info): Add explanatory comments.
New local update_blocks. Use update_blocks to remove duplicates
when computing update blocks. Check for bblst_table overflow.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8621e8a8c28..00e7b910d72 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3506,7 +3506,12 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
default:
/* Don't allow initializations for incomplete types
except for arrays which might be completed by the initialization. */
- if (COMPLETE_TYPE_P (TREE_TYPE (decl)))
+
+ /* This can happen if the array size is an undefined macro. We already
+ gave a warning, so we don't need another one. */
+ if (TREE_TYPE (decl) == error_mark_node)
+ initialized = 0;
+ else if (COMPLETE_TYPE_P (TREE_TYPE (decl)))
{
/* A complete type is ok if size is fixed. */
@@ -3584,7 +3589,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
&& DECL_RTL (tem) == 0
&& !DECL_CONTEXT (tem))
{
- if (COMPLETE_TYPE_P (TREE_TYPE (tem)))
+ if (TREE_TYPE (tem) != error_mark_node
+ && COMPLETE_TYPE_P (TREE_TYPE (tem)))
expand_decl (tem);
else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
&& DECL_INITIAL (tem) != 0)
@@ -3679,10 +3685,13 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == VAR_DECL)
{
- if (DECL_SIZE (decl) == 0 && COMPLETE_TYPE_P (TREE_TYPE (decl)))
+ if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node
+ && COMPLETE_TYPE_P (TREE_TYPE (decl)))
layout_decl (decl, 0);
if (DECL_SIZE (decl) == 0
+ /* Don't give an error if we already gave one earlier. */
+ && TREE_TYPE (decl) != error_mark_node
&& (TREE_STATIC (decl)
?
/* A static variable with an incomplete type