From patchwork Wed May 25 19:56:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: C++ PATCH for c++/45698 (crash with variadics) Date: Wed, 25 May 2011 09:56:54 -0000 From: Nathan Froyd X-Patchwork-Id: 97410 Message-Id: <4DDD5F06.80504@codesourcery.com> To: Jason Merrill Cc: gcc-patches List 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. 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; };