This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: COFF debugging info bug


I wrote:
> 
> Current CVS gcc will segfault for following f.i, when
> invoked as
[...]
> Can anyone look into this?

I've tracked it down. The very minimal testcase is

struct x {
   char a[0];
};

Previously host_integerp was being called with DECL_SIZE(tree)
of zero, and this causes NULL dereferences there. Because other
debugging formats do not output anything about zero length data
types neither, I just added a check to skip it.

Can anyone install it if it's OK?

2000-11-27  Laurynas Biveinis  <lauras@softhome.net>

	* sdbout.c (sdbout_field_types, sdbout_one_type): Skip
        zero-sized data types.

--- sdbout.c.orig	Sun Oct 22 00:05:48 2000
+++ sdbout.c	Mon Nov 27 19:20:35 2000
@@ -1062,7 +1062,8 @@ sdbout_field_types (type)
     /* This condition should match the one for emitting the actual members
        below.  */
     if (TREE_CODE (tail) == FIELD_DECL
-	&& DECL_NAME (tail) != 0
+	&& DECL_NAME (tail)
+	&& DECL_SIZE (tail)
 	&& ! host_integerp (DECL_SIZE (tail), 1)
 	&& ! host_integerp (bit_position (tail), 0))
       {
@@ -1243,7 +1244,8 @@ sdbout_one_type (type)
 	       Also omit fields with variable size or position.
 	       Also omit non FIELD_DECL nodes that GNU C++ may put here.  */
 	    if (TREE_CODE (tem) == FIELD_DECL
-		&& DECL_NAME (tem) != 0
+		&& DECL_NAME (tem)
+		&& DECL_SIZE (tem)
 		&& host_integerp (DECL_SIZE (tem), 1)
 		&& host_integerp (bit_position (tem), 0))
 	      {

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