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 c++/110295] [10/11/12/13/14 Regression] ICE in dwarf2out_finish with local class with inherited operator delete in a templated function and -g
Date: Mon, 19 Jun 2023 07:21:25 +0000	[thread overview]
Message-ID: <bug-110295-4-ZaE6CfLfIq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110295-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110295

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) p debug_dwarf_die (deferred_asm_name->die)
DIE    0: DW_TAG_subprogram (0x7ffff6e4aaa0)
  abbrev id: 0 offset: 0 mark: 0
  DW_AT_external: 1
  DW_AT_name: "thing_t"
  DW_AT_artificial: 1
  DW_AT_declaration: 1
  DW_AT_object_pointer: die -> 0 (0x7ffff6e4aaf0)
    DIE    0: DW_TAG_formal_parameter (0x7ffff6e4aaf0)
      abbrev id: 0 offset: 0 mark: 0
      DW_AT_type: die -> 0 (0x7ffff6e4a1e0)
      DW_AT_artificial: 1
(gdb) p deferred_asm_name->created_for 
$4 = <function_decl 0x7ffff6feaa00 __ct >

created via

(gdb) bt
#0  add_linkage_name_raw (
    die=<dw_die_ref 0x7ffff6e4aaa0 DW_TAG_subprogram <parent=0x7ffff6e4a230
DW_TAG_structure_type>>, decl=<function_decl 0x7ffff6feaa00 __ct >)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22023
#1  0x00000000013ef18a in add_linkage_name (
    die=<dw_die_ref 0x7ffff6e4aaa0 DW_TAG_subprogram <parent=0x7ffff6e4a230
DW_TAG_structure_type>>, decl=<function_decl 0x7ffff6feaa00 __ct >)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22047
#2  0x00000000013ef2b8 in add_name_and_src_coords_attributes (
    die=<dw_die_ref 0x7ffff6e4aaa0 DW_TAG_subprogram <parent=0x7ffff6e4a230
DW_TAG_structure_type>>, decl=<function_decl 0x7ffff6feaa00 __ct >, 
    no_linkage_name=false)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22072
#3  0x00000000013f363d in gen_subprogram_die (
    decl=<function_decl 0x7ffff6feaa00 __ct >, 
    context_die=<dw_die_ref 0x7ffff6e4a230 DW_TAG_structure_type
<parent=0x7ffff6e4a410 DW_TAG_subprogram>>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:23701
#4  0x00000000013fda8f in gen_decl_die (
    decl=<function_decl 0x7ffff6feaa00 __ct >, origin=<tree 0x0>, 
    ctx=0x7fffffffd1b0, 
    context_die=<dw_die_ref 0x7ffff6e4a230 DW_TAG_structure_type
<parent=0x7ffff6e4a410 DW_TAG_subprogram>>)
#5  0x00000000013f9dc5 in gen_member_die (
    type=<record_type 0x7ffff6fdeb28 thing_t>, 
    context_die=<dw_die_ref 0x7ffff6e4a230 DW_TAG_structure_type
<parent=0x7ffff6e4a410 DW_TAG_subprogram>>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:25858
#6  0x00000000013fa517 in gen_struct_or_union_type_die (
    type=<record_type 0x7ffff6fdeb28 thing_t>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:25954
#7  0x00000000013faff8 in gen_tagged_type_die (
    type=<record_type 0x7ffff6fdeb28 thing_t>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26155
#8  0x00000000013fb94f in gen_type_die_with_usage (
    type=<record_type 0x7ffff6fdeb28 thing_t>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26349
#9  0x00000000013fbcec in gen_type_die (
    type=<record_type 0x7ffff6fdeb28 thing_t>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26404
#10 0x00000000013fdc7f in gen_decl_die (
    decl=<type_decl 0x7ffff6fe51c8 thing_t>, origin=<tree 0x0>, ctx=0x0, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27043
#11 0x00000000013fc3e4 in process_scope_var (stmt=<block 0x7ffff6fd06c0>, 
    decl=<type_decl 0x7ffff6fe51c8 thing_t>, origin=<tree 0x0>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26557
#12 0x00000000013fc46d in decls_for_scope (stmt=<block 0x7ffff6fd06c0>, 
    context_die=<dw_die_ref 0x7ffff6e4a410 DW_TAG_subprogram
<parent=0x7ffff6e4a000 DW_TAG_compile_unit>>, recurse=true)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26583
#13 0x00000000013f4757 in gen_subprogram_die (
    decl=<function_decl 0x7ffff6fcb900 exercise>, 
    context_die=<dw_die_ref 0x7ffff6e4a000 DW_TAG_compile_unit>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:24087
#14 0x00000000013fda8f in gen_decl_die (
    decl=<function_decl 0x7ffff6fcb900 exercise>, origin=<tree 0x0>, ctx=0x0, 
    context_die=<dw_die_ref 0x7ffff6e4a000 DW_TAG_compile_unit>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27020
#15 0x00000000013ff1da in dwarf2out_decl (
    decl=<function_decl 0x7ffff6fcb900 exercise>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27601
#16 0x00000000013ff239 in dwarf2out_function_decl (
    decl=<function_decl 0x7ffff6fcb900 exercise>)
    at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27616
#17 0x00000000014bfa35 in rest_of_handle_final ()
    at /space/rguenther/src/gcc11queue/gcc/final.cc:4274

interestingly we do not arrive at the member DIE creation of the typedef
from the outermost frames.  In fact we create the type DIE for
thing_t before processing the local typedef decl but there it's not
final it seems but simply

 <record_type 0x7ffff6fdeb28 thing_t cxx-odr-p type_5 type_6 VOID
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6fdeb28 context <function_decl 0x7ffff6fcb900 exercise>
    full-name "struct exercise<1>()::thing_t"
    no-binfo use_template=1 interface-unknown
    pointer_to_this <pointer_type 0x7ffff6fded20> chain <type_decl
0x7ffff6fe51c8 thing_t>>

and we then run into

/* Process variable DECL (or variable with origin ORIGIN) within
   block STMT and add it to CONTEXT_DIE.  */
static void
process_scope_var (tree stmt, tree decl, tree origin, dw_die_ref context_die)
{
...
  if (die != NULL && die->die_parent == NULL)
    add_child_die (context_die, die);

because appearantly we have created the DIE in limbo.  Of course when
running into this code late we now have a parent and end up creating
the decl DIE.

I think we want to continue creating the DIE for the decl here.  The following
fixes this issue.

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index d89ffa66847..e70c47cec8d 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -26533,7 +26533,8 @@ process_scope_var (tree stmt, tree decl, tree origin,
dw_die_ref context_die)

   if (die != NULL && die->die_parent == NULL)
     add_child_die (context_die, die);
-  else if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
+
+  if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
     {
       if (early_dwarf)
        dwarf2out_imported_module_or_decl_1 (decl_or_origin, DECL_NAME
(decl_or_origin),

  parent reply	other threads:[~2023-06-19  7:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  8:04 [Bug c++/110295] New: internal compiler error: in dwarf2out_finish duz@sol-3.de
2023-06-17 18:49 ` [Bug c++/110295] " pinskia at gcc dot gnu.org
2023-06-17 19:05 ` [Bug c++/110295] [10/11/12/13/14 Regression] ICE in dwarf2out_finish with local class with inherited operator delete in a templated function and -g pinskia at gcc dot gnu.org
2023-06-19  7:21 ` rguenth at gcc dot gnu.org [this message]
2023-06-20  7:02 ` cvs-commit at gcc dot gnu.org
2023-06-20  7:02 ` [Bug c++/110295] [10/11/12/13 " rguenth at gcc dot gnu.org
2023-06-23 10:30 ` cvs-commit at gcc dot gnu.org
2023-07-07 10:45 ` [Bug c++/110295] [11/12 " rguenth at gcc dot gnu.org
2023-11-27 11:34 ` cvs-commit at gcc dot gnu.org
2023-12-15 12:18 ` [Bug c++/110295] [11 " cvs-commit at gcc dot gnu.org
2023-12-15 12:20 ` 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-110295-4-ZaE6CfLfIq@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).