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]

[C++ PATCH] Fix 9054


Hi,
I've installed this patch for 9054, a -fdump-translation-unit ICE.
Mark's patch to produce separate RECORD_DECLS for base classes broke
the dumper.

built & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org

2002-12-27  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/9054
	* class.c (layout_class_type): Set DECL_CONTEXT of type for base.
	* dump.c (cp_dump_tree, RECORD_TYPE): Deal with type for base types.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.502
diff -c -3 -p -r1.502 class.c
*** cp/class.c	20 Dec 2002 16:11:41 -0000	1.502
--- cp/class.c	27 Dec 2002 18:12:05 -0000
*************** layout_class_type (tree t, tree *virtual
*** 5162,5167 ****
--- 5162,5168 ----
  
        /* Record the base version of the type.  */
        CLASSTYPE_AS_BASE (t) = base_t;
+       TYPE_CONTEXT (base_t) = t;
      }
    else
      CLASSTYPE_AS_BASE (t) = t;
Index: cp/dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/dump.c,v
retrieving revision 1.65
diff -c -3 -p -r1.65 dump.c
*** cp/dump.c	16 Dec 2002 18:22:13 -0000	1.65
--- cp/dump.c	27 Dec 2002 18:12:50 -0000
*************** cp_dump_tree (dump_info, t)
*** 265,270 ****
--- 265,278 ----
  	  return 1;
  	}
  
+       /* Is it a type used as a base? */
+       if (TYPE_CONTEXT (t) && TREE_CODE (TYPE_CONTEXT (t)) == TREE_CODE (t)
+ 	  && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
+ 	{
+ 	  dump_child ("bfld", TYPE_CONTEXT (t));
+ 	  return 1;
+ 	}
+       
        dump_child ("vfld", TYPE_VFIELD (t));
        if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
          dump_string(di, "spec");

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