From: Richard Biener Date: Fri, 30 Jan 2026 08:55:38 +0000 (+0100) Subject: debug/110885 - fix split-dwarf / debug-types interaction X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Ftrunk;p=thirdparty%2Fgcc.git debug/110885 - fix split-dwarf / debug-types interaction 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. --- diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 345b12134dd..1ad944fc1d0 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -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 index 00000000000..48ad8002935 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr110885.C @@ -0,0 +1,16 @@ +// { dg-do link } +// { dg-options "-gsplit-dwarf -fdebug-types-section" } + +inline void foo() {} + +struct Y +{ + template + static void bar() {} +}; + +int main() +{ + Y::bar(); + return 0; +}