https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108772
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, the limbo DIE is created via
#0 new_die (tag_value=DW_TAG_variable, parent_die=<dw_die_ref 0x0>,
t=<var_decl 0x7ffff6271ea0 __tag>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:5882
#1 0x0000000000e006ad in gen_variable_die (
decl=<var_decl 0x7ffff6271ea0 __tag>, origin=<tree 0x0>,
context_die=<dw_die_ref 0x0>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:24574
#2 0x0000000000e08766 in gen_decl_die (decl=<var_decl 0x7ffff6271ea0 __tag>,
origin=<tree 0x0>, ctx=0x0, context_die=<dw_die_ref 0x0>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:27108
#3 0x0000000000e09a73 in dwarf2out_decl (decl=<var_decl 0x7ffff6271ea0 __tag>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:27598
#4 0x0000000000e08dce in dwarf2out_late_global_decl (
decl=<var_decl 0x7ffff6271ea0 __tag>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:27286
#5 0x0000000001944222 in varpool_node::assemble_decl (
this=<varpool_node * const 0x7ffff7ff3080 "__tag"/0>)
at /home/rguenther/src/trunk/gcc/varpool.cc:603
#6 0x0000000001944a08 in symbol_table::output_variables (this=0x7ffff626a000)
at /home/rguenther/src/trunk/gcc/varpool.cc:764
when compiling without -flto we do not get any DIE for __tag. In the LTRANS
unit the decl is
<var_decl 0x7ffff6271ea0 __tag
type <integer_type 0x7ffff60cf1f8 char readonly public QI
size <integer_cst 0x7ffff6266d38 constant 8>
unit-size <integer_cst 0x7ffff6266d50 constant 1>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff62803f0 precision:8 min <integer_cst 0x7ffff60a4e28 -128> max
<integer_cst 0x7ffff60a4e10 127>
pointer_to_this <pointer_type 0x7ffff60cf3f0>>
readonly constant addressable asm_written used public static QI t.ii:8:27
size <integer_cst 0x7ffff6266d38 8> unit-size <integer_cst 0x7ffff6266d50 1>
align:8 warn_if_not_align:0 context <function_decl 0x7ffff60d0a00 _S_ti>
initial <integer_cst 0x7ffff60a4e40 0>
(mem/u/c:QI (symbol_ref:DI ("_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag")
<var_decl 0x7ffff6271ea0 __tag>) [0 __tag+0 S1 A8])>
at compile time the symbol is
_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag/0 (constexpr const char __tag)
Type: variable definition analyzed
Visibility: semantic_interposition public weak comdat
comdat_group:_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag one_only
References:
Referring: _ZNSt23_Sp_counted_ptr_inplace14_M_get_deleterERKi/9 (addr)
Availability: not-ready
Varpool flags: initialized read-only const-value-known
at WPA time
_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag/0 (__tag)
Type: variable definition analyzed
Visibility: externally_visible semantic_interposition
prevailing_def_ironly_exp public weak comdat
comdat_group:_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag one_only
References:
Referring: _ZNSt23_Sp_counted_ptr_inplace14_M_get_deleterERKi/9 (addr)
Read from file: a-t.o
Availability: available
Varpool flags: initialized read-only const-value-known
When without -flto we reach varpool_node::assemble_decl we see
<var_decl 0x7ffff6274e10 __tag
type <integer_type 0x7ffff6295690 char readonly public type_6 QI
size <integer_cst 0x7ffff628b0c0 constant 8>
unit-size <integer_cst 0x7ffff628b0d8 constant 1>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6295690 precision:8 min <integer_cst 0x7ffff628b108 -128> max
<integer_cst 0x7ffff628b138 127>
pointer_to_this <pointer_type 0x7ffff6295738>>
readonly constant addressable used public static tree_1 tree_2 tree_6 weak
read decl_5 decl_6 decl_8 QI t.ii:8:27 size <integer_cst 0x7ffff628b0c0 8>
unit-size <integer_cst 0x7ffff628b0d8 1>
align:8 warn_if_not_align:0 context <function_decl 0x7ffff6415800 _S_ti>
initial <integer_cst 0x7ffff642b138 0>
(mem/u/c:QI (symbol_ref/i:DI ("_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag")
<var_decl 0x7ffff6274e10 __tag>) [0 __tag+0 S1 A8])>
but dwarf2out_late_global_decl just does nothing for this node since
there was no DIE created early for it - we never call early_global_decl
on it, instead we rely on the containing function, _S_ti, to eventually
create a DIE for it, but even that doesn't get one.
I suppose this is all a disconnect between how we handle -g1 with -flto,
and for -g1 dwarf2out_late_global_decl should not fall into
/* Fill-in any location information we were unable to determine
on the first pass. */
if (VAR_P (decl))
{
dw_die_ref die = lookup_decl_die (decl);
/* We may have to generate full debug late for LTO in case debug
was not enabled at compile-time or the target doesn't support
the LTO early debug scheme. */
if (! die && in_lto_p)
dwarf2out_decl (decl);
another possibility would be to stream "no DIE" info for not late
created decls or experiment with simply removing this path entirely?