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]

dwarf2out bugfix patch


This patch fixes three minor bugs I noticed while working on the
include CU patch.

1) We weren't clearing the second word of val_long_long.
2) When splicing a member DIE into the specification DIE of a class, we
   failed to remove it from the declaration DIE for the class, so we
   ended up emitting the member DIE twice.
3) We were adding a redundant AT_name to the specification DIE of a class.

2000-08-28  Jason Merrill  <jason@redhat.com>

	* dwarf2out.c (new_loc_descr): Use calloc.
	(splice_child_die): Remove the die from the right parent.
	(gen_struct_or_union_die): Don't add AT_name to a specification DIE.

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.197
diff -c -p -r1.197 dwarf2out.c
*** dwarf2out.c	2000/08/24 20:39:11	1.197
--- dwarf2out.c	2000/08/28 23:07:23
*************** new_loc_descr (op, oprnd1, oprnd2)
*** 2470,2479 ****
       register unsigned long oprnd1;
       register unsigned long oprnd2;
  {
    register dw_loc_descr_ref descr
!     = (dw_loc_descr_ref) xmalloc (sizeof (dw_loc_descr_node));
  
-   descr->dw_loc_next = NULL;
    descr->dw_loc_opc = op;
    descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
    descr->dw_loc_oprnd1.v.val_unsigned = oprnd1;
--- 2470,2480 ----
       register unsigned long oprnd1;
       register unsigned long oprnd2;
  {
+   /* Use xcalloc here so we clear out all of the long_long constant in
+      the union.  */
    register dw_loc_descr_ref descr
!     = (dw_loc_descr_ref) xcalloc (1, sizeof (dw_loc_descr_node));
  
    descr->dw_loc_opc = op;
    descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
    descr->dw_loc_oprnd1.v.val_unsigned = oprnd1;
*************** splice_child_die (parent, child)
*** 4649,4655 ****
        && child->die_parent != get_AT_ref (parent, DW_AT_specification))
      abort ();
  
!   for (p = &(parent->die_child); *p; p = &((*p)->die_sib))
      if (*p == child)
        {
  	*p = child->die_sib;
--- 4650,4656 ----
        && child->die_parent != get_AT_ref (parent, DW_AT_specification))
      abort ();
  
!   for (p = &(child->die_parent->die_child); *p; p = &((*p)->die_sib))
      if (*p == child)
        {
  	*p = child->die_sib;
*************** gen_struct_or_union_type_die (type, cont
*** 9185,9193 ****
  			  ? DW_TAG_structure_type : DW_TAG_union_type,
  			  scope_die);
        equate_type_number_to_die (type, type_die);
-       add_name_attribute (type_die, type_tag (type));
        if (old_die)
  	add_AT_die_ref (type_die, DW_AT_specification, old_die);
      }
    else
      remove_AT (type_die, DW_AT_declaration);
--- 9186,9195 ----
  			  ? DW_TAG_structure_type : DW_TAG_union_type,
  			  scope_die);
        equate_type_number_to_die (type, type_die);
        if (old_die)
  	add_AT_die_ref (type_die, DW_AT_specification, old_die);
+       else
+ 	add_name_attribute (type_die, type_tag (type));
      }
    else
      remove_AT (type_die, DW_AT_declaration);

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