]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/91887 (-fdebug-types-section ICE building chromium)
authorRichard Biener <rguenther@suse.de>
Wed, 23 Oct 2019 10:32:06 +0000 (10:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 23 Oct 2019 10:32:06 +0000 (10:32 +0000)
2019-10-23  Richard Biener  <rguenther@suse.de>

Backport from mainline
2019-10-17  Richard Biener  <rguenther@suse.de>

PR debug/91887
* dwarf2out.c (gen_formal_parameter_die): Also try to match
context_die against a DW_TAG_GNU_formal_parameter_pack parent.

* g++.dg/debug/dwarf2/pr91887.C: New testcase.

From-SVN: r277312

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C [new file with mode: 0644]

index d213669fdb4839830efe01196ba356b51986b774..1ab4bb9195387375c500cab7e029607d9dc3e084 100644 (file)
@@ -1,3 +1,12 @@
+2019-10-23  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-10-17  Richard Biener  <rguenther@suse.de>
+
+       PR debug/91887
+       * dwarf2out.c (gen_formal_parameter_die): Also try to match
+       context_die against a DW_TAG_GNU_formal_parameter_pack parent.
+
 2019-10-21  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index 60a986e1c3019c4284b6c6aeac1ebefc982f81a9..55a73e12cc258227f568d17179990585a18e1513 100644 (file)
@@ -22284,19 +22284,18 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
       /* If the contexts differ, we may not be talking about the same
         thing.
         ???  When in LTO the DIE parent is the "abstract" copy and the
-        context_die is the specification "copy".  But this whole block
-        should eventually be no longer needed.  */
-      if (parm_die && parm_die->die_parent != context_die && !in_lto_p)
+        context_die is the specification "copy".  */
+      if (parm_die
+         && parm_die->die_parent != context_die
+         && (parm_die->die_parent->die_tag != DW_TAG_GNU_formal_parameter_pack
+             || parm_die->die_parent->die_parent != context_die)
+         && !in_lto_p)
        {
-         if (!DECL_ABSTRACT_P (node))
-           {
-             /* This can happen when creating an inlined instance, in
-                which case we need to create a new DIE that will get
-                annotated with DW_AT_abstract_origin.  */
-             parm_die = NULL;
-           }
-         else
-           gcc_unreachable ();
+         gcc_assert (!DECL_ABSTRACT_P (node));
+         /* This can happen when creating a concrete instance, in
+            which case we need to create a new DIE that will get
+            annotated with DW_AT_abstract_origin.  */
+         parm_die = NULL;
        }
 
       if (parm_die && parm_die->die_parent == NULL)
index 54707bd1e0676ce7114554b533310ebbd5e6d579..7c7e0bf8375342ba8d413cdd4fba49f96d53637c 100644 (file)
@@ -1,3 +1,11 @@
+2019-10-23  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-10-17  Richard Biener  <rguenther@suse.de>
+
+       PR debug/91887
+       * g++.dg/debug/dwarf2/pr91887.C: New testcase.
+
 2019-10-21  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C
new file mode 100644 (file)
index 0000000..6cd99cc
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-options "-g -fdebug-types-section" }
+class A {
+public:
+  A();
+  template <typename U> A(U);
+};
+template <class> struct B { typedef A type; };
+template <class R, typename... Args>
+int Bind(R(Args...), typename B<Args>::type...) { return 0; }
+void KeepBufferRefs(A, A) { A a, b(Bind(KeepBufferRefs, a, b)); }