This fixes a tree dumping ICE involving static thunk fns. Copying the
thunked-to fn's context suffices.
nathan
--
Nathan Sidwell
2018-01-03 Nathan Sidwell <nat...@acm.org>
PR c++/83667
* method.c (make_alias_for): Copy DECL_CONTEXT.
PR c++/83667
* g++.dg/ipa/pr83667.C: New.
Index: cp/method.c
===================================================================
--- cp/method.c (revision 256175)
+++ cp/method.c (working copy)
@@ -206,7 +206,7 @@ make_alias_for (tree target, tree newid)
TREE_CODE (target), newid, TREE_TYPE (target));
DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target);
cxx_dup_lang_specific_decl (alias);
- DECL_CONTEXT (alias) = NULL;
+ DECL_CONTEXT (alias) = DECL_CONTEXT (target);
TREE_READONLY (alias) = TREE_READONLY (target);
TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
TREE_PUBLIC (alias) = 0;
Index: testsuite/g++.dg/ipa/pr83667.C
===================================================================
--- testsuite/g++.dg/ipa/pr83667.C (revision 0)
+++ testsuite/g++.dg/ipa/pr83667.C (working copy)
@@ -0,0 +1,23 @@
+/* { dg-options "-fdump-ipa-inline" } */
+// c++/83667 ICE dumping a static thunk
+
+struct a
+{
+ virtual ~a ();
+};
+
+struct b
+{
+ virtual void d (...);
+};
+
+struct c : a, b
+{
+ void d (...)
+ {
+ }
+};
+
+c c;
+
+// { dg-final { scan-ipa-dump "summary for void c::\\*.LTHUNK0" "inline" } }