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++/107058] [11/12/13/14 Regression] ICE in dwarf2out_die_ref_for_decl, at dwarf2out.cc:6038 since r11-5003-gd50310408f54e380
Date: Tue, 23 Jan 2024 08:52:01 +0000	[thread overview]
Message-ID: <bug-107058-4-DMFeG4VTnT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107058-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|debug                       |c++

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
The particular reason we even stream the CONST_DECL is that it appears in

int __attribute__((aligned (A))) foo;

via the attribute list:

 <var_decl 0x7ffff6a1ae10 foo
    type <integer_type 0x7ffff6a305e8 int asm_written public type_6 SI
        size <integer_cst 0x7ffff6a2a408 constant 32>
        unit-size <integer_cst 0x7ffff6a2a420 constant 4>
        align:32 warn_if_not_align:0 symtab:-157035984 alias-set 2
canonical-type 0x7ffff6a305e8 precision:32 min <integer_cst 0x7ffff6a2a3c0
-2147483648> max <integer_cst 0x7ffff6a2a3d8 2147483647>
        pointer_to_this <pointer_type 0x7ffff6a37b28>>
    addressable public static SI pr50459.c:13:34 size <integer_cst
0x7ffff6a2a408 32> unit-size <integer_cst 0x7ffff6a2a420 4>
    user align:1024 warn_if_not_align:0 context <translation_unit_decl
0x7ffff6a19168 pr50459.c>
    attributes <tree_list 0x7ffff6bc6000
        purpose <identifier_node 0x7ffff6a2c980 aligned>
        value <tree_list 0x7ffff6bb9be0 value <const_decl 0x7ffff6bc5000 A>>>
chain <var_decl 0x7ffff6a1ad80 a>>

where we "failed" to replace the CONST_DECL with its value.  When handling
the attribute we're doing

      align_expr = TREE_VALUE (args);
      if (align_expr && TREE_CODE (align_expr) != IDENTIFIER_NODE
          && TREE_CODE (align_expr) != FUNCTION_DECL)
        align_expr = default_conversion (align_expr);

and that resolves it to an INTEGER_CST for further processing.

I'll note that streaming out debug references from certain contexts like
attribute arguments is also unnecessary but it's difficult to selectively
disable it.

IMO the correct thing to do is for the C++ frontend to, like the C frontend,
resolve the enumerators before calling common_handle_aligned_attribute.

It's also possible to more gracefully handle the assert it's still a bug.
I'm going to handle it gracefully when not checking.

  parent reply	other threads:[~2024-01-23  8:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 16:27 [Bug c++/107058] New: [11/12/13 Regression] ICE in dwarf2out_die_ref_for_decl, at dwarf2out.cc:6038 gscfq@t-online.de
2022-09-27 16:31 ` [Bug debug/107058] " pinskia at gcc dot gnu.org
2022-09-27 16:42 ` [Bug ipa/107058] " mpolacek at gcc dot gnu.org
2022-09-27 17:24 ` [Bug ipa/107058] [11/12/13 Regression] ICE in dwarf2out_die_ref_for_decl, at dwarf2out.cc:6038 since r11-5003-gd50310408f54e380 marxin at gcc dot gnu.org
2022-09-29  8:05 ` [Bug debug/107058] " rguenth at gcc dot gnu.org
2023-05-29 10:07 ` [Bug debug/107058] [11/12/13/14 " jakub at gcc dot gnu.org
2024-01-23  8:52 ` rguenth at gcc dot gnu.org [this message]
2024-01-23 10:15 ` [Bug c++/107058] " cvs-commit at gcc dot gnu.org
2024-01-23 10:16 ` rguenth at gcc dot gnu.org
2024-03-22 14:02 ` law 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-107058-4-DMFeG4VTnT@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).