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 for crash with -gdwarf-2 -O2



This patch was actually submitted a while back, but required back-end
changes.  Since they've been made, I've now put in this patch, which
avoid crashes with -g -O2 on platforms that use DWARF2.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-07-31  Mark Mitchell  <mark@markmitchell.com>

	* decl.c (pushdecl): Don't copy types if the
	DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
	type. 

Index: testsuite/g++.old-deja/g++.other/crash3.C
===================================================================
RCS file: crash3.C
diff -N crash3.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- crash3.C	Thu Sep 10 11:13:20 1998
***************
*** 0 ****
--- 1,14 ----
+ // Build don't link:
+ // Special g++ Options: -g -O2
+ 
+ inline void f() {
+   struct S {};
+   S s;
+ }
+ 
+ int g()
+ {
+   for (int i = 0; i < 2; ++i)
+     f();
+ }
+ 
Index: cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.209
diff -c -p -r1.209 decl.c
*** decl.c	1998/09/09 00:52:40	1.209
--- decl.c	1998/09/10 18:13:59
*************** pushdecl (x)
*** 3479,3485 ****
  	      if (TYPE_NAME (type) == 0)
  	        TYPE_NAME (type) = x;
              }
!           else if (type != error_mark_node && TYPE_NAME (type) != x)
              {
  	      push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
  
--- 3479,3490 ----
  	      if (TYPE_NAME (type) == 0)
  	        TYPE_NAME (type) = x;
              }
!           else if (type != error_mark_node && TYPE_NAME (type) != x
! 		   /* We don't want to copy the type when all we're
! 		      doing is making a TYPE_DECL for the purposes of
! 		      inlining.  */
! 		   && (!TYPE_NAME (type) 
! 		       || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
              {
  	      push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
  


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