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]

Patch to dwarf2out.c applied


Hi Guys,

  I have just applied the following patch to dwarf2out.c.  It stops
  the compiler from aborting when it tries to generate debug
  information for an incomplete type.  This can arise when trying to
  emit the debug information for an inlined function.  eg try
  compiling the following with -g -O3:

     int foo (void) { struct bar * ptr; return 1; }

  I will check an appropriate testcase into the repository in a little
  while.

Cheers
	Nick

Tue Sep 28 16:43:14 1999  Nick Clifton  <nickc@cygnus.com>

	* dwarf2out.c (add_abstract_origin_attribute): Abort if
	origin_die is NULL.
	(gen_inlined_enumeration_type_die): Do not abort if the type has
	not been writeen out.
	(gen_inlined_structure_type_die): Do not abort if the type has
	not been writeen out.
	(gen_inlined_union_type_die): Do not abort if the type has
	not been writeen out.
	(gen_tagged_type_instantiation_die): Do not abort if the type
	has not been written out.


Index: dwarf2out.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dwarf2out.c,v
retrieving revision 1.119
diff -p -r1.119 dwarf2out.c
*** dwarf2out.c	1999/09/22 21:42:03	1.119
--- dwarf2out.c	1999/09/28 16:52:38
*************** add_abstract_origin_attribute (die, orig
*** 7635,7645 ****
--- 7635,7649 ----
       register tree origin;
  {
    dw_die_ref origin_die = NULL;
+ 
    if (TREE_CODE_CLASS (TREE_CODE (origin)) == 'd')
      origin_die = lookup_decl_die (origin);
    else if (TREE_CODE_CLASS (TREE_CODE (origin)) == 't')
      origin_die = lookup_type_die (origin);
  
+   if (origin_die == NULL)
+     abort ();
+   
    add_AT_die_ref (die, DW_AT_abstract_origin, origin_die);
  }
  
*************** gen_inlined_enumeration_type_die (type, 
*** 8129,8137 ****
  {
    register dw_die_ref type_die = new_die (DW_TAG_enumeration_type,
  					  scope_die_for (type, context_die));
! 
!   if (!TREE_ASM_WRITTEN (type))
!     abort ();
    add_abstract_origin_attribute (type_die, type);
  }
  
--- 8133,8140 ----
  {
    register dw_die_ref type_die = new_die (DW_TAG_enumeration_type,
  					  scope_die_for (type, context_die));
!   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
!      be incomplete and such types are not marked.  */
    add_abstract_origin_attribute (type_die, type);
  }
  
*************** gen_inlined_structure_type_die (type, co
*** 8144,8152 ****
  {
    register dw_die_ref type_die = new_die (DW_TAG_structure_type,
  					  scope_die_for (type, context_die));
! 
!   if (!TREE_ASM_WRITTEN (type))
!     abort ();
    add_abstract_origin_attribute (type_die, type);
  }
  
--- 8147,8154 ----
  {
    register dw_die_ref type_die = new_die (DW_TAG_structure_type,
  					  scope_die_for (type, context_die));
!   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
!      be incomplete and such types are not marked.  */
    add_abstract_origin_attribute (type_die, type);
  }
  
*************** gen_inlined_union_type_die (type, contex
*** 8159,8167 ****
  {
    register dw_die_ref type_die = new_die (DW_TAG_union_type,
  					  scope_die_for (type, context_die));
! 
!   if (!TREE_ASM_WRITTEN (type))
!     abort ();
    add_abstract_origin_attribute (type_die, type);
  }
  
--- 8161,8168 ----
  {
    register dw_die_ref type_die = new_die (DW_TAG_union_type,
  					  scope_die_for (type, context_die));
!   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
!      be incomplete and such types are not marked.  */
    add_abstract_origin_attribute (type_die, type);
  }
  
*************** gen_tagged_type_instantiation_die (type,
*** 9333,9342 ****
       this type (i.e. without any const or volatile qualifiers) so make sure
       that we have the main variant (i.e. the unqualified version) of this
       type now.  */
!   if (type != type_main_variant (type)
!       || !TREE_ASM_WRITTEN (type))
      abort ();
  
    switch (TREE_CODE (type))
      {
      case ERROR_MARK:
--- 9334,9345 ----
       this type (i.e. without any const or volatile qualifiers) so make sure
       that we have the main variant (i.e. the unqualified version) of this
       type now.  */
!   if (type != type_main_variant (type))
      abort ();
  
+   /* Do not check TREE_ASM_WRITTEN(type) as it may not be set if this is
+      an instance of an unresolved type.  */
+   
    switch (TREE_CODE (type))
      {
      case ERROR_MARK:



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