[PR c++/83667] Fix tree_dump ICE
authorNathan Sidwell <nathan@acm.org>
Wed, 3 Jan 2018 16:01:31 +0000 (16:01 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 3 Jan 2018 16:01:31 +0000 (16:01 +0000)
https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00148.html
PR c++/83667
* method.c (make_alias_for): Copy DECL_CONTEXT.

PR c++/83667
* g++.dg/ipa/pr83667.C: New.

From-SVN: r256179

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr83667.C [new file with mode: 0644]

index 506684aeb47c8c1da6c083fc59ca2ded17ab461d..4f8f8394273fb037be2a018f78e316d499a35319 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-03  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/83667
+       * method.c (make_alias_for): Copy DECL_CONTEXT.
+
 2018-01-03  Marek Polacek  <polacek@redhat.com>
 
        PR c++/83592
index 6b080c04fa28e40fd4fe948a6a672aecf9715331..55c84f12399cc36e1f1efc0441c63c84c38a524e 100644 (file)
@@ -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 f389dea6971ae233663241a18c7baee987f1096f..e252ae0f080c9d9ffd51bca24d691170869b6e8b 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-03  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/83667
+       * g++.dg/ipa/pr83667.C: New.
+
 2018-01-03  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/83593
diff --git a/gcc/testsuite/g++.dg/ipa/pr83667.C b/gcc/testsuite/g++.dg/ipa/pr83667.C
new file mode 100644 (file)
index 0000000..5fbfa8e
--- /dev/null
@@ -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" } }