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 ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
Date: Mon, 27 Mar 2023 14:37:10 +0000	[thread overview]
Message-ID: <bug-106124-4-jV40DOjWGe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106124-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2023-03-27
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
We have

(gdb) p debug_tree (type)
 <record_type 0x7ffff64452a0 ._anon_1 asm_written cxx-odr-p type_5 QI
    size <integer_cst 0x7ffff628b0c0 type <integer_type 0x7ffff62890a8
bitsizetype> constant 8>
...

with TREE_ASM_WRITTEN but not a DIE recorded.  For this reason
gen_type_die_with_usage does nothing.

Earlier we created a DIE for the type but we pruned it as unused later via

#0  mark_removed (
    die=<dw_die_ref 0x7ffff645c4b0 DW_TAG_structure_type <parent=0x7ffff6296000
DW_TAG_compile_unit>>) at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30245
#1  0x00000000013c291a in prune_unused_types_prune (
    die=<dw_die_ref 0x7ffff6296000 DW_TAG_compile_unit>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30278
#2  0x00000000013c2c21 in prune_unused_types ()
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30363
#3  0x00000000013c8cdb in dwarf2out_early_finish (filename=0x45b83a0 "t.ii")
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:32997

we can possibly "fix" that failure to re-create the DIE late by making
sure to also clear TREE_ASM_WRITTEN on it.

Of course the question is why we have no early DIE for the function

 <function_decl 0x7ffff6444b00 _FUN
    type <function_type 0x7ffff629e0a8
...
    full-name "static constexpr int A::omp declare reduction
x~i(T&)::<lambda()>::_FUN()"

I suppose that's the OMP reduction function and that's always(?) inlined?

The following fixes the ICE, but as said I wonder why nothing creates a
DIE for the function early?

I'm going to test this and propose it still.

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 1711ad2c2da..1a0015ce00f 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -5894,6 +5894,7 @@ lookup_type_die (tree type)
   if (die && die->removed)
     {
       TYPE_SYMTAB_DIE (type) = NULL;
+      TREE_ASM_WRITTEN (type) = 0;
       return NULL;
     }
   return die;

  parent reply	other threads:[~2023-03-27 14:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 17:11 [Bug c++/106124] New: " gscfq@t-online.de
2022-06-28 18:45 ` [Bug ipa/106124] " marxin at gcc dot gnu.org
2022-06-29  9:45 ` rguenth at gcc dot gnu.org
2022-06-29 11:23 ` jakub at gcc dot gnu.org
2023-03-27 14:37 ` rguenth at gcc dot gnu.org [this message]
2023-03-28 14:58 ` jakub at gcc dot gnu.org
2023-03-29  6:46 ` rguenther at suse dot de
2023-03-29  6:56 ` cvs-commit at gcc dot gnu.org
2023-03-29  6:57 ` [Bug ipa/106124] [11/12 " rguenth at gcc dot gnu.org
2023-04-17  9:14 ` cvs-commit at gcc dot gnu.org
2023-05-02 12:03 ` [Bug ipa/106124] [11 " cvs-commit at gcc dot gnu.org
2023-05-02 12:05 ` 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-106124-4-jV40DOjWGe@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).