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]
Other format: [Raw text]

PATCH: Fix debug/12103.C


This patch fixes a debug info generation crash in a rather unique C++
situation.  The key is to avoid calling lookup_base unncessarily,
because that calls complete_type, and that results in debug info being
generated for the type, and things are Not Quite Ready for that yet.
Of course, debug info for types should really not be generated until
later -- it's a mistake to generate it in real time as classes are
completed.  However, that's not going to be changed any time soon.

Tested on i686-pc-linux-gnu, applied on the GCC 3.4 branch and on the
mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-02-29  Mark Mitchell  <mark@codesourcery.com>

	PR debug/12103
	* class.c (update_vtable_entry_for_fn): Do not go through
	covariance machinery if the type returned by an overrider is the
	same as the original.

2004-02-29  Mark Mitchell  <mark@codesourcery.com>

	PR debug/12103
	* g++.dg/debug/crash1.C: New test.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.601
diff -c -5 -p -r1.601 class.c
*** cp/class.c	16 Feb 2004 02:35:48 -0000	1.601
--- cp/class.c	29 Feb 2004 23:10:10 -0000
*************** update_vtable_entry_for_fn (tree t, tree
*** 2088,2098 ****
  	   there.  */
  	virtual_offset =
  	  TREE_VALUE (purpose_member
  		      (BINFO_TYPE (virtual_offset),
  		       CLASSTYPE_VBASECLASSES (TREE_TYPE (over_return))));
!       else
  	{
  	  /* There was no existing virtual thunk (which takes
  	     precedence).  */
  	  tree thunk_binfo;
  	  base_kind kind;
--- 2088,2099 ----
  	   there.  */
  	virtual_offset =
  	  TREE_VALUE (purpose_member
  		      (BINFO_TYPE (virtual_offset),
  		       CLASSTYPE_VBASECLASSES (TREE_TYPE (over_return))));
!       else if (!same_type_p (TREE_TYPE (over_return),
! 			     TREE_TYPE (base_return)))
  	{
  	  /* There was no existing virtual thunk (which takes
  	     precedence).  */
  	  tree thunk_binfo;
  	  base_kind kind;
Index: testsuite/g++.dg/debug/crash1.C
===================================================================
RCS file: testsuite/g++.dg/debug/crash1.C
diff -N testsuite/g++.dg/debug/crash1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/debug/crash1.C	29 Feb 2004 23:10:10 -0000
***************
*** 0 ****
--- 1,17 ----
+ template <typename T>
+ class foo
+ {
+   T t;
+ };
+ 
+ class bar;
+ typedef foo<bar> foobar;
+ 
+ class obj
+ {
+   virtual foobar* yeah() = 0;
+ };
+ 
+ class bar : virtual public obj
+ {
+ };


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