public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO
@ 2024-01-18 18:14 jakub at gcc dot gnu.org
  2024-01-18 18:14 ` [Bug lto/113488] " jakub at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113488
           Summary: [14 Regression] ICE in add_AT_die_ref with LTO
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

nodejs18/nodejs20 and libreoffice (the last one s390x only) ICE with GCC 14 and
LTO
with
./cc1plus -fpreprocessed /tmp/v8_turboshaft.late-optimization-phase.ii -quiet
-g1 -O3 -std=gnu++17 -fPIC -flto=4 -fuse-linker-plugin -ffat-lto-objects -o
/tmp/v8_turboshaft.late-optimization-phase.s; ./xg++ -B ./ -shared -nostdlib
-flto=4 -fuse-linker-plugin -ffat-lto-objects -o /tmp/libnode.so.115
-Wl,-soname=libnode.so.115 /tmp/v8_turboshaft.late-optimization-phase.s
/tmp/v8_turboshaft.late-optimization-phase.ii: In member function
‘ReduceTrapIf’:
/tmp/v8_turboshaft.late-optimization-phase.ii:129252: internal compiler error:
in add_AT_die_ref, at dwarf2out.cc:4913
129252 |   }
0x73bcc5 add_AT_die_ref
        ../../gcc/dwarf2out.cc:4913
0x73bcc5 add_AT_external_die_ref
        ../../gcc/dwarf2out.cc:6084
0x73bcc5 add_abstract_origin_attribute
        ../../gcc/dwarf2out.cc:21990
0xf4529d gen_label_die
        ../../gcc/dwarf2out.cc:24831
0xf4529d gen_decl_die
        ../../gcc/dwarf2out.cc:27137
0xf626df decls_for_scope
        ../../gcc/dwarf2out.cc:26669
0xf3fd02 gen_subprogram_die
        ../../gcc/dwarf2out.cc:24167
0xf448da gen_decl_die
        ../../gcc/dwarf2out.cc:27106
0xf45aeb dwarf2out_decl
        ../../gcc/dwarf2out.cc:27687
0xf45f3e dwarf2out_function_decl
        ../../gcc/dwarf2out.cc:27702
0xfd5326 rest_of_handle_final
        ../../gcc/final.cc:4273
0xfd5326 execute
        ../../gcc/final.cc:4317
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug lto/113488] [14 Regression] ICE in add_AT_die_ref with LTO
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
@ 2024-01-18 18:14 ` jakub at gcc dot gnu.org
  2024-01-18 18:15 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|13.2.1                      |14.0
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug lto/113488] [14 Regression] ICE in add_AT_die_ref with LTO
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
  2024-01-18 18:14 ` [Bug lto/113488] " jakub at gcc dot gnu.org
@ 2024-01-18 18:15 ` jakub at gcc dot gnu.org
  2024-01-18 18:28 ` [Bug debug/113488] " jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57143
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57143&action=edit
v8_turboshaft.late-optimization-phase.ii.xz

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
  2024-01-18 18:14 ` [Bug lto/113488] " jakub at gcc dot gnu.org
  2024-01-18 18:15 ` jakub at gcc dot gnu.org
@ 2024-01-18 18:28 ` jakub at gcc dot gnu.org
  2024-01-19  6:22 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Trying to cvise reduce this now.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-18 18:28 ` [Bug debug/113488] " jakub at gcc dot gnu.org
@ 2024-01-19  6:22 ` jakub at gcc dot gnu.org
  2024-01-19  7:04 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19  6:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57151
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57151&action=edit
v8_turboshaft.late-optimization-phase.ii

./cc1plus -fpreprocessed v8_turboshaft.late-optimization-phase.ii -quiet -g1
-O3 -std=gnu++17 -fPIC -flto=4 -fuse-linker-plugin -o
v8_turboshaft.late-optimization-phase.s; ./xg++ -B ./ -shared -nostdlib -flto=4
-fuse-linker-plugin -ffat-lto-objects -o libnode.so.115
-Wl,-soname=libnode.so.115 v8_turboshaft.late-optimization-phase.s

Reduced testcase

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-19  6:22 ` jakub at gcc dot gnu.org
@ 2024-01-19  7:04 ` jakub at gcc dot gnu.org
  2024-01-19  7:09 ` [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546 jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-01-19

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the assert has been added in
r14-5546-g1bcb7fe60544bba8b88028f9ffa062336d399664
but will try to verify if it really ICEs since then.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-19  7:04 ` jakub at gcc dot gnu.org
@ 2024-01-19  7:09 ` jakub at gcc dot gnu.org
  2024-01-19  7:22 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regression] ICE in      |[14 Regression] ICE in
                   |add_AT_die_ref with LTO     |add_AT_die_ref with LTO
                   |                            |since r14-5546

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Verified we ICE on this starting with r14-5546

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-19  7:09 ` [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546 jakub at gcc dot gnu.org
@ 2024-01-19  7:22 ` rguenth at gcc dot gnu.org
  2024-01-19  8:50 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-19  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

(gdb) p debug_dwarf_die (die)
DIE    0: DW_TAG_label (0x7ffff68dc410)
  abbrev id: 0 offset: 0 mark: 0
(gdb) p attr_kind
$2 = DW_AT_abstract_origin

and in gen_label_die we do

  tree origin = decl_ultimate_origin (decl);
  dw_die_ref lbl_die = lookup_decl_die (decl);
  rtx insn;
  char label[MAX_ARTIFICIAL_LABEL_BYTES];

  if (!lbl_die)
    { 
      lbl_die = new_die (DW_TAG_label, context_die, decl);
      equate_decl_number_to_die (decl, lbl_die);

      if (origin != NULL)
        add_abstract_origin_attribute (lbl_die, origin);

but origin == decl here.

(gdb) p decl->decl_common.abstract_origin 
$6 = <label_decl 0x7ffff7fc8e00 no_change>

that's read this way from the LTO data.  A workaround right in dwarf2out
is possible, but I'll see if this self-reference makes sense (and where
it comes from).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-01-19  7:22 ` rguenth at gcc dot gnu.org
@ 2024-01-19  8:50 ` rguenth at gcc dot gnu.org
  2024-01-19  8:52 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-19  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so it's of course set_decl_origin_self () invoked via

#0  set_decl_origin_self (decl=<label_decl 0x7ffff684f400 no_change>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23321
#1  0x00000000014ddc14 in set_block_origin_self (stmt=<block 0x7ffff6c05cc0>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23290
#2  0x00000000014dde88 in set_decl_origin_self (
    decl=<function_decl 0x7ffff6842400 ReduceTrapIf>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23329
#3  0x00000000014de0c8 in dwarf2out_abstract_function (
    decl=<function_decl 0x7ffff6842400 ReduceTrapIf>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23379
#4  0x0000000001c0bce5 in tree_function_versioning (
    old_decl=<function_decl 0x7ffff6842400 ReduceTrapIf>, 
    new_decl=<function_decl 0x7ffff6883500
_ZN24BranchEliminationReducerI12ReducerStackIiJ26MachineOptimizationReducerN12_GLOBAL__N_121ValueNumberingReducerEEEE12ReduceTrapIfE7OpIndexbNS2_6TrapIdE.part.0>,
tree_map=0x0, 
    param_adjustments=0x4c3ad30, update_clones=false, 
    blocks_to_copy=0x4be47a8, new_entry=<basic_block 0x7ffff6872600 (4)>)
    at /home/rguenther/src/trunk/gcc/tree-inline.cc:6222
#5  0x000000000144476f in cgraph_node::create_version_clone_with_body (
    this=<cgraph_node * const 0x7ffff6a23bb0 "ReduceTrapIf"/8>, 
    redirect_callers=..., tree_map=0x0, param_adjustments=0x4c3ad30, 
    bbs_to_copy=0x4be47a8, new_entry_block=<basic_block 0x7ffff6872600 (4)>, 
    suffix=0x434dc0d "part", target_attributes=<tree 0x0>, version_decl=true)
    at /home/rguenther/src/trunk/gcc/cgraphclones.cc:1084
#6  0x000000000343c0d4 in split_function (
    return_bb=<basic_block 0x7ffff68654e0 (EXIT)>, 
    split_point=0x4b13ba0 <best_split_point>, add_tsan_func_exit=false)
    at /home/rguenther/src/trunk/gcc/ipa-split.cc:1376

interesting enough we didn't generate a DIE for the LABEL_DECL for the
abstract instance DIE.  Instead we just have

(gdb) p debug_dwarf_die (old_die)
DIE  262: DW_TAG_subprogram (0x7ffff6867dc0)
  abbrev id: 4 offset: 262 mark: 0
  DW_AT_name: "ReduceTrapIf"
  DW_AT_decl_file: "t.ii" (1)
  DW_AT_decl_line: 102
  DW_AT_decl_column: 11
  DW_AT_inline: 3

there.  During early dwarf generation for this function we do not consider
it possibly inlined, so

      /* If we're emitting a possibly inlined function emit it as
         abstract instance.  */
      else if (cgraph_function_possibly_inlined_p (decl)
               && ! DECL_ABSTRACT_P (decl)
               && ! class_or_namespace_scope_p (context_die)
               /* dwarf2out_abstract_function won't emit a die if this is just
                  a declaration.  We must avoid setting DECL_ABSTRACT_ORIGIN in
                  that case, because that works only if we have a die.  */
               && DECL_INITIAL (decl) != NULL_TREE)
        dwarf2out_abstract_function (decl);

doesn't trigger and

      /* Otherwise we're emitting the primary DIE for this decl.  */
      else if (debug_info_level > DINFO_LEVEL_TERSE)

neither.

Instead we just generate the plain decl DIE.  But we still do
dwarf2out_abstract_function later for the clone origin.

It's a bit complicated (-g1 wrecks quite some invariants), so I think I'm
going to try fixup after the fact in LTO.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-01-19  8:50 ` rguenth at gcc dot gnu.org
@ 2024-01-19  8:52 ` jakub at gcc dot gnu.org
  2024-01-19  9:43 ` cvs-commit at gcc dot gnu.org
  2024-01-19  9:48 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> interesting enough we didn't generate a DIE for the LABEL_DECL for the
> abstract instance DIE.  Instead we just have

Maybe because of -g1?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-01-19  8:52 ` jakub at gcc dot gnu.org
@ 2024-01-19  9:43 ` cvs-commit at gcc dot gnu.org
  2024-01-19  9:48 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-19  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:62b59bc4f70d02a485c527aa3277f4b4010edb6b

commit r14-8281-g62b59bc4f70d02a485c527aa3277f4b4010edb6b
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 19 09:50:43 2024 +0100

    debug/113488 - DW_AT_abstract_origin to self

    The new sanity check avoiding creating of DIE refs to self triggers
    on the PRs testcase when using -g1 and -ffat-lto-objects as while
    early DWARF with -g1 doesn't contain any DIEs for LABEL_DECLs later
    cloning will still mark DECLs as in if they would via
    dwarf2out_abstract_function calling set_block_origin_self.

    Instead of messing with the delicate setup of dwarf2out at this stage
    the following simply rectifies things after the fact during LTO
    streaming when the decl indicates there's an early DIE but there
    isn't fixup that indication.

            PR debug/113488
            * lto-streamer-in.cc (lto_read_tree_1): When there isn't
            an early DIE but there should be, do not pretend there is.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546
  2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-01-19  9:43 ` cvs-commit at gcc dot gnu.org
@ 2024-01-19  9:48 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-19  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-19  9:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 18:14 [Bug lto/113488] New: [14 Regression] ICE in add_AT_die_ref with LTO jakub at gcc dot gnu.org
2024-01-18 18:14 ` [Bug lto/113488] " jakub at gcc dot gnu.org
2024-01-18 18:15 ` jakub at gcc dot gnu.org
2024-01-18 18:28 ` [Bug debug/113488] " jakub at gcc dot gnu.org
2024-01-19  6:22 ` jakub at gcc dot gnu.org
2024-01-19  7:04 ` jakub at gcc dot gnu.org
2024-01-19  7:09 ` [Bug debug/113488] [14 Regression] ICE in add_AT_die_ref with LTO since r14-5546 jakub at gcc dot gnu.org
2024-01-19  7:22 ` rguenth at gcc dot gnu.org
2024-01-19  8:50 ` rguenth at gcc dot gnu.org
2024-01-19  8:52 ` jakub at gcc dot gnu.org
2024-01-19  9:43 ` cvs-commit at gcc dot gnu.org
2024-01-19  9:48 ` rguenth at gcc dot gnu.org

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).