[Bug lto/91772] New: [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] New: [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

            Bug ID: 91772
           Summary: [8/9/10 Regression] ICE in add_dwarf_attr, at
                    dwarf2out.c:4412 since r259749
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Following is ICEing:

$ g++ -flto=16 -c -g1 -O2 1.ii 2.ii 3.ii 4.ii 5.ii 6.ii 7.ii && g++ -g -o
godot.x11.opt.debug.64 -flto=16 1.o 2.o 3.o 4.o 5.o 6.o 7.o -fchecking
...
during IPA pass: materialize-all-clones
lto1: internal compiler error: in add_dwarf_attr, at dwarf2out.c:4413
0x5d67de add_dwarf_attr
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:4413
0x5d67de add_dwarf_attr
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:4400
0x5d67de add_AT_int
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:4473
0x5d67de add_const_value_attribute
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:19565
0x9147ca dwarf2out_late_global_decl
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:26686
0x9147ca dwarf2out_late_global_decl
        /home/marxin/Programming/gcc/gcc/dwarf2out.c:26655
0xab989d symbol_table::remove_unreachable_nodes(_IO_FILE*)
        /home/marxin/Programming/gcc/gcc/ipa.c:602
0xab61cf execute
        /home/marxin/Programming/gcc/gcc/ipa.c:1396
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [/tmp/ccYgkmEb.mk:2:
/tmp/godot.x11.opt.debug.64.gG99Ba.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/home/marxin/bin/binutils/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Sorry, I can't reduce it more.
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|2019-09-14 00:00:00         |2019-09-16
   Target Milestone|---                         |8.4
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Attachment missing?
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 46886
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46886&action=edit
Test-case
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so this happens when the DIE was not created early (due to -g1) then we do

      /* We may have to generate early debug late for LTO in case debug
         was not enabled at compile-time or the target doesn't support
         the LTO early debug scheme.  */
      if (! die && in_lto_p)
        {
          dwarf2out_decl (decl);
          die = lookup_decl_die (decl);
        }

where dwarf2out_decl already adds a DW_AT_location attribute.  Then
we fall through to

      if (die)
        {
          /* We get called via the symtab code invoking late_global_decl
             for symbols that are optimized out.

             Do not add locations for those, except if they have a
             DECL_VALUE_EXPR, in which case they are relevant for debuggers.
             Still don't add a location if the DECL_VALUE_EXPR is not a trivial
             INDIRECT_REF expression, as this could generate relocations to
             text symbols in LTO object files, which is invalid.  */
          varpool_node *node = varpool_node::get (decl);
          if ((! node || ! node->definition)
              && ! (DECL_HAS_VALUE_EXPR_P (decl)
                    && is_trivial_indirect_ref (DECL_VALUE_EXPR (decl))))
            tree_add_const_value_attribute_for_decl (die, decl);
          else
            add_location_or_const_value_attribute (die, decl, false);
        }

obviously above we're not only creating "early" debug.  It seems obvious
to me that we want to skip the later code which is intended for early
dwarf only.
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9/10 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 46889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46889&action=edit
patch
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
      Known to work|                            |10.0
            Summary|[8/9/10 Regression] ICE in  |[8/9 Regression] ICE in
                   |add_dwarf_attr, at          |add_dwarf_attr, at
                   |dwarf2out.c:4412 since      |dwarf2out.c:4412 since
                   |r259749                     |r259749
      Known to fail|10.0                        |

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Sep 17 13:52:20 2019
New Revision: 275804

URL: https://gcc.gnu.org/viewcvs?rev=275804&root=gcc&view=rev
Log:
2019-09-17  Richard Biener  <[hidden email]>

        PR debug/91772
        * dwarf2out.c (dwarf2out_late_global_decl): If early dwarf
        was missing generate locations only once.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
Reply | Threaded
Open this post in threaded view
|

[Bug lto/91772] [8/9 Regression] ICE in add_dwarf_attr, at dwarf2out.c:4412 since r259749

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91772

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Oct 16 09:25:34 2019
New Revision: 277055

URL: https://gcc.gnu.org/viewcvs?rev=277055&root=gcc&view=rev
Log:
2019-10-16  Richard Biener  <[hidden email]>

        Backport from mainline
        2019-10-04  Richard Biener  <[hidden email]>

        PR lto/91968
        * tree.c (find_decls_types_r): Do not remove LABEL_DECLs from
        BLOCK_VARS.

        2019-10-02  Richard Biener  <[hidden email]>

        PR c++/91606
        * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
        fat pointer structure members as DECL_NONADDRESSABLE_P.

        * g++.dg/torture/pr91606.C: New testcase.

        2019-09-19  Richard Biener  <[hidden email]>

        PR tree-optimization/91812
        * tree-ssa-phiprop.c (propagate_with_phi): Do not replace
        volatile loads.

        * gcc.dg/torture/pr91812.c: New testcase.

        2019-09-17  Richard Biener  <[hidden email]>

        PR debug/91772
        * dwarf2out.c (dwarf2out_late_global_decl): If early dwarf
        was missing generate locations only once.

        2019-09-17  Richard Biener  <[hidden email]>

        PR tree-optimization/91790
        * tree-vect-stmts.c (vectorizable_load): For BB vectorization
        use the correct DR for setting up realignment.

Added:
    branches/gcc-9-branch/gcc/testsuite/g++.dg/torture/pr91606.C
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/torture/pr91812.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/cp/ChangeLog
    branches/gcc-9-branch/gcc/cp/decl.c
    branches/gcc-9-branch/gcc/dwarf2out.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
    branches/gcc-9-branch/gcc/tree-ssa-phiprop.c
    branches/gcc-9-branch/gcc/tree-vect-stmts.c
    branches/gcc-9-branch/gcc/tree.c