Patchwork C++ PATCH for c++/45698 (crash with variadics)

login
register
mail settings
Submitter Nathan Froyd
Date May 25, 2011, 7:56 p.m.
Message ID <4DDD5F06.80504@codesourcery.com>
Download mbox | patch
Permalink /patch/97410/
State New
Headers show

Comments

Nathan Froyd - May 25, 2011, 7:56 p.m.
On 05/25/2011 03:45 PM, Jason Merrill wrote:
> While looking at this, I also noticed that print_node expects everything to
> have TREE_TYPE, which is no longer correct.

Technically, I think this is not true; everything inherits from tree_common;
or at least tree_typed.  (I had the bit of print_node fixing in one of my
patches; thanks for getting it in ahead of me!)  Once the STATEMENT_LIST and
BLOCK slimming patches are in, there will indeed be things that don't have
TREE_TYPE.  If something doesn't have TREE_TYPE, then the Right Thing to do
would be to fix the tree structure so that it only inherits from tree_base.

Like the following (totally untested) patch.  WDYT?  (It's certainly possible
that other C++-specific trees could be modified in the same way;
tree_static_assert jumps out, for instance.)

-Nathan

gcc/cp/
	* cp-tree.h (struct tree_argument_pack_select): Inherit from
	tree_base.
Jason Merrill - May 25, 2011, 8 p.m.
On 05/25/2011 03:56 PM, Nathan Froyd wrote:
> 	* cp-tree.h (struct tree_argument_pack_select): Inherit from
> 	tree_base.

OK if it passes testing.

Jason

Patch

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ada01fb..a315986 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -534,7 +534,7 @@  struct GTY (()) tree_static_assert {
 };

 struct GTY (()) tree_argument_pack_select {
-  struct tree_common common;
+  struct tree_base base;
   tree argument_pack;
   int index;
 };