public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/108772] [13 Regression] ICE in force_decl_die, at dwarf2out.cc:26751 since r13-4161-g32d16fe9d7e347bc
Date: Tue, 14 Feb 2023 12:22:16 +0000	[thread overview]
Message-ID: <bug-108772-4-j5G3v7JZC1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108772-4@http.gcc.gnu.org/bugzilla/>

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?

  parent reply	other threads:[~2023-02-14 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 12:06 [Bug c++/108772] New: " marxin at gcc dot gnu.org
2023-02-13 12:06 ` [Bug debug/108772] " marxin at gcc dot gnu.org
2023-02-13 12:35 ` jakub at gcc dot gnu.org
2023-02-13 14:00 ` marxin at gcc dot gnu.org
2023-02-13 15:14 ` rguenth at gcc dot gnu.org
2023-02-14 11:50 ` rguenth at gcc dot gnu.org
2023-02-14 12:22 ` rguenth at gcc dot gnu.org [this message]
2023-02-20 13:37 ` rguenth at gcc dot gnu.org
2023-02-21 12:26 ` rguenth at gcc dot gnu.org
2023-02-21 12:48 ` rguenth at gcc dot gnu.org
2023-02-21 13:32 ` rguenth at gcc dot gnu.org
2023-03-03  7:27 ` cvs-commit at gcc dot gnu.org
2023-03-03  7:34 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108772-4-j5G3v7JZC1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).