From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A15E93858D3C; Mon, 19 Jun 2023 07:21:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A15E93858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687159286; bh=cryjN50K52yTUMUQP+Z1SPmypP/rKKpk0MKLUILT0GA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qnkqQK8eDtl2oatMNlU0Ukl0bmil22K07PDMMxBDep617kYp/2zTCX2s1jgcV5r34 beoBWkUAKqpM+kvJXp1HCyvdcrOvuEmofpl9TJxPVYRnQPegNQggmo+psyyJ6sPFmG 05xfJ4w85JRCAWiEdx6vK4LaSoKWpJk5C/4pZEP8= From: "rguenth at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.4.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to keywords Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110295 Richard Biener 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 --- (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=20 $4 =3D created via (gdb) bt #0 add_linkage_name_raw ( die=3D>, decl=3D) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22023 #1 0x00000000013ef18a in add_linkage_name ( die=3D>, decl=3D) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22047 #2 0x00000000013ef2b8 in add_name_and_src_coords_attributes ( die=3D>, decl=3D,=20 no_linkage_name=3Dfalse) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:22072 #3 0x00000000013f363d in gen_subprogram_die ( decl=3D,=20 context_die=3D>) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:23701 #4 0x00000000013fda8f in gen_decl_die ( decl=3D, origin=3D,=20 ctx=3D0x7fffffffd1b0,=20 context_die=3D>) #5 0x00000000013f9dc5 in gen_member_die ( type=3D,=20 context_die=3D>) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:25858 #6 0x00000000013fa517 in gen_struct_or_union_type_die ( type=3D,=20 context_die=3D>, usage=3DDINFO_USAGE_DIR_USE) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:25954 #7 0x00000000013faff8 in gen_tagged_type_die ( type=3D,=20 context_die=3D>, usage=3DDINFO_USAGE_DIR_USE) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26155 #8 0x00000000013fb94f in gen_type_die_with_usage ( type=3D,=20 context_die=3D>, usage=3DDINFO_USAGE_DIR_USE) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26349 #9 0x00000000013fbcec in gen_type_die ( type=3D,=20 context_die=3D>) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26404 #10 0x00000000013fdc7f in gen_decl_die ( decl=3D, origin=3D, ctx=3D0= x0,=20 context_die=3D>) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27043 #11 0x00000000013fc3e4 in process_scope_var (stmt=3D,= =20 decl=3D, origin=3D,=20 context_die=3D>) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26557 #12 0x00000000013fc46d in decls_for_scope (stmt=3D,=20 context_die=3D>, recurse=3Dtrue) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:26583 #13 0x00000000013f4757 in gen_subprogram_die ( decl=3D,=20 context_die=3D) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:24087 #14 0x00000000013fda8f in gen_decl_die ( decl=3D, origin=3D, ct= x=3D0x0,=20 context_die=3D) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27020 #15 0x00000000013ff1da in dwarf2out_decl ( decl=3D) at /space/rguenther/src/gcc11queue/gcc/dwarf2out.cc:27601 #16 0x00000000013ff239 in dwarf2out_function_decl ( decl=3D) 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 full-name "struct exercise<1>()::thing_t" no-binfo use_template=3D1 interface-unknown pointer_to_this chain > 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_di= e) { ... if (die !=3D NULL && die->die_parent =3D=3D 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 follow= ing 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 origi= n, dw_die_ref context_die) if (die !=3D NULL && die->die_parent =3D=3D NULL) add_child_die (context_die, die); - else if (TREE_CODE (decl_or_origin) =3D=3D IMPORTED_DECL) + + if (TREE_CODE (decl_or_origin) =3D=3D IMPORTED_DECL) { if (early_dwarf) dwarf2out_imported_module_or_decl_1 (decl_or_origin, DECL_NAME (decl_or_origin),=