]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
debug/110885 - fix split-dwarf / debug-types interaction
authorRichard Biener <rguenther@suse.de>
Fri, 30 Jan 2026 08:55:38 +0000 (09:55 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 30 Jan 2026 10:57:31 +0000 (11:57 +0100)
The following fixes a link failure due to missing skeleton
ancestors.

PR debug/110885
* dwarf2out.cc (generate_skeleton_bottom_up): Generate the
skeleton ancestor tree when moving a new child to the parent
even for template instantiations.

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

gcc/dwarf2out.cc
gcc/testsuite/g++.dg/debug/dwarf2/pr110885.C [new file with mode: 0644]

index 345b12134dd68af8d75da3c04a51335ea8524e1c..1ad944fc1d008e4887aa559c1c0951757e688664 100644 (file)
@@ -8545,6 +8545,7 @@ generate_skeleton_bottom_up (skeleton_chain_node *parent)
               type unit.  Just move the DIE and its children back to
               the skeleton tree (in the main CU).  */
            remove_child_with_prev (c, prev);
+           generate_skeleton_ancestor_tree (parent);
            add_child_die (parent->new_die, c);
            c = prev;
          }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr110885.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr110885.C
new file mode 100644 (file)
index 0000000..48ad800
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-do link }
+// { dg-options "-gsplit-dwarf -fdebug-types-section" }
+
+inline void foo() {}
+
+struct Y
+{
+    template<void (*func)()>
+    static void bar() {}
+};
+
+int main()
+{
+    Y::bar<foo>();
+    return 0;
+}