On Tue, Jan 27, 2026 at 03:07:54PM +0100, Richard Biener wrote:
> The following makes sure to mangle decls referenced in initializers,
> even when of aggregate type, during the early debug phase since
> later we eventually leave stray supposedly unused CV qualified
> types as their own main variant which confuses C++ mangling. The
> comment that refers to rtl_for_decl_init punting might be
> accurate, but loc_list_from_tree_1 will happily see to
> cst_pool_loc_descr where constant pool lookup will eventually
> create DECL_RTL of referenced symbols, triggering mangling.
>
> LTO Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> OK?
>
> Thanks,
> Richard.
>
> PR debug/123376
> * dwarf2out.cc (tree_add_const_value_attribute): Walk all
> initializers for early mangling of referenced decls.
> (mangle_referenced_decls): Also walk subtrees of CONSTRUCTORS.
>
> * g++.dg/lto/pr123376_0.C: New testcase.
LGTM.
Jakub