This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix bootstrap failure due to complete types with nonnull C_TYPE_INCOMPLETE_VARS

This patch solves the recent bootstrap failures due to ICE in dbxout.c
or dwarf2out.c.  The bug was an incorrect assumption in c-decl.c: that
if a variable had an incomplete type, and that type was composed from
a struct or union type, that type must also be incomplete.  There are
several exceptions, perhaps the most important being array-of-structure 
variables with unspecified length.  Thus, variables were getting
attached to the C_TYPE_INCOMPLETE_VARS chain for complete types, which
exposed this front-end-private concept to dbxout/dwarf2out, which did
not understand it.  (The type field being used for C_TYPE_INCOMPLETE_VARS
in the C front end has several other uses - it's not used for anything
else in RECORD_TYPE and UNION_TYPE nodes in C, but the debug info
generators don't know that, nor should they.)

Attaching these variables to C_TYPE_INCOMPLETE_VARS for anything is
unnecessary; their incompleteness is handled through other means.
Hence the appended patch.

Bootstrapped on sparc-sun-solaris2.9 with and without --enable-dwarf2,
thanks to Andreas Tobler for testing.


        * c-decl.c (pushdecl): Don't put variables on
        C_TYPE_INCOMPLETE_VARS of a type unless that type is itself

Index: c-decl.c
--- c-decl.c	30 Aug 2003 21:24:19 -0000	1.439
+++ c-decl.c	1 Sep 2003 17:22:24 -0000
@@ -1761,7 +1761,8 @@ pushdecl (tree x)
 	  if ((TREE_CODE (element) == RECORD_TYPE
 	       || TREE_CODE (element) == UNION_TYPE)
 	      && (TREE_CODE (x) != TYPE_DECL
+	      && !COMPLETE_TYPE_P (element))
 	    C_TYPE_INCOMPLETE_VARS (element)
 	      = tree_cons (NULL_TREE, x, C_TYPE_INCOMPLETE_VARS (element));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]