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]

dwarfout.c (dwarfout_file_scope_decl): If DECL_CONTEXT, don't abort...


This fixes a DWARF1/C++ problem.  Gcc can hit an abort while compiling a C++
source file that has a class with a member function defined inside another
function.  This gives something kind of like a nested function, and dwarfout.c
can't handle it right.  I don't think the resulting debug info is exactly
correct, but it looks reasonable enough, and dwarf1/C++ is already broken
enough that I don't think it will do any harm.

I've already checked this in.

1998-10-27  Jim Wilson  <wilson@cygnus.com>

	* dwarfout.c (dwarfout_file_scope_decl): If DECL_CONTEXT, don't abort
	if pending_types is non-zero.
	(dwarfout_finish): Verify pending_types is zero before finishing.

Index: dwarfout.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dwarfout.c,v
retrieving revision 1.90
diff -p -r1.90 dwarfout.c
*** dwarfout.c	1998/10/09 23:02:30	1.90
--- dwarfout.c	1998/10/28 03:32:06
*************** dwarfout_file_scope_decl (decl, set_fina
*** 5247,5256 ****
  
    output_pending_types_for_scope (NULL_TREE);
  
!   /* The above call should have totally emptied the pending_types_list.  */
! 
!   if (pending_types != 0)
!     abort ();
  
    ASM_OUTPUT_POP_SECTION (asm_out_file);
  
--- 5247,5262 ----
  
    output_pending_types_for_scope (NULL_TREE);
  
!   /* The above call should have totally emptied the pending_types_list
!      if this is not a nested function or class.  If this is a nested type,
!      then the remaining pending_types will be emitted when the containing type
!      is handled.  */
!   
!   if (! DECL_CONTEXT (decl))
!     {
!       if (pending_types != 0)
! 	abort ();
!     }
  
    ASM_OUTPUT_POP_SECTION (asm_out_file);
  
*************** dwarfout_finish ()
*** 6003,6008 ****
--- 6009,6020 ----
  
        ASM_OUTPUT_POP_SECTION (asm_out_file);
      }
+ 
+   /* There should not be any pending types left at the end.  We need
+      this now because it may not have been checked on the last call to
+      dwarfout_file_scope_decl.  */
+   if (pending_types != 0)
+     abort ();
  }
  
  #endif /* DWARF_DEBUGGING_INFO */



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