This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH c++/pr87295] -fdebug-types-section ICE


Richard,
this patch makes the ICE go away, but I really don't know if it's correct. When cloning the type die I copy die_id, so it is found during the (currently ICEing) hash lookup. In this particular testcase we clone the die twice. Once from break_out_comdat_types and once from copy_decls_for_unworthy_types. That seems a little strange (but I have only the smallest understanding of debug data) As these tracebacks show:

Breakpoint 5, clone_as_declaration (
die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>)
    at ../../../src/gcc/dwarf2out.c:8179
8179	  clone->die_id = die->die_id;
(gdb) back
#0 clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>)
    at ../../../src/gcc/dwarf2out.c:8179
#1 0x0000000000e34faf in generate_skeleton_ancestor_tree (node=0x7fffffffe230) at ../../../src/gcc/dwarf2out.c:8345 #2 0x0000000000e351c3 in generate_skeleton_bottom_up (parent=0x7fffffffe230) at ../../../src/gcc/dwarf2out.c:8419
#3  0x0000000000e35291 in generate_skeleton (
die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>)
    at ../../../src/gcc/dwarf2out.c:8449
#4 0x0000000000e352ce in remove_child_or_replace_with_skeleton (unit=<dw_die_ref 0x7ffff7326780 DW_TAG_type_unit>, child=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>, prev=<dw_die_ref 0x7ffff7326550 DW_TAG_pointer_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>)
    at ../../../src/gcc/dwarf2out.c:8471
#5 0x0000000000e3570a in break_out_comdat_types (die=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>)
    at ../../../src/gcc/dwarf2out.c:8636
#6 0x0000000000e75153 in dwarf2out_early_finish (filename=0x34de9d0 "bug.ii") at ../../../src/gcc/dwarf2out.c:32034 #7 0x0000000000daa210 in symbol_table::finalize_compilation_unit (this=0x7ffff730d100) at ../../../src/gcc/cgraphunit.c:2783
#8  0x0000000001417ec2 in compile_file () at ../../../src/gcc/toplev.c:480
#9  0x000000000141a90c in do_compile () at ../../../src/gcc/toplev.c:2170
#10 0x000000000141abf8 in toplev::main (this=0x7fffffffe56e, argc=8, argv=0x7fffffffe668) at ../../../src/gcc/toplev.c:2305 #11 0x000000000227731e in main (argc=8, argv=0x7fffffffe668) at ../../../src/gcc/main.c:39
(gdb) p clone
$2 = <dw_die_ref 0x7ffff7326820 DW_TAG_structure_type>
(gdb) c
Continuing.

Breakpoint 5, clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff7326780 DW_TAG_type_unit>>)
    at ../../../src/gcc/dwarf2out.c:8179
8179	  clone->die_id = die->die_id;
(gdb) p clone
$3 = <dw_die_ref 0x7ffff7326a50 DW_TAG_structure_type>
(gdb) back
#0 clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff7326780 DW_TAG_type_unit>>)
    at ../../../src/gcc/dwarf2out.c:8179
#1 0x0000000000e34dac in copy_ancestor_tree (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type <parent=0x7ffff7326780 DW_TAG_type_unit>>, decl_table=0x7fffffffe2f0)
    at ../../../src/gcc/dwarf2out.c:8267
#2 0x0000000000e35adb in copy_decls_walk (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, die=<dw_die_ref 0x7ffff73264b0 DW_TAG_subprogram <parent=0x7ffff7326820 DW_TAG_structure_type>>, decl_table=0x7fffffffe2f0)
    at ../../../src/gcc/dwarf2out.c:8764
#3 0x0000000000e35ba6 in copy_decls_walk (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, die=<dw_die_ref 0x7ffff7326820 DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>, decl_table=0x7fffffffe2f0)
    at ../../../src/gcc/dwarf2out.c:8790
#4 0x0000000000e35ba6 in copy_decls_walk (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, die=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, decl_table=0x7fffffffe2f0) at ../../../src/gcc/dwarf2out.c:8790 #5 0x0000000000e35c09 in copy_decls_for_unworthy_types (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>)
    at ../../../src/gcc/dwarf2out.c:8804
#6 0x0000000000e7519a in dwarf2out_early_finish (filename=0x34de9d0 "bug.ii") at ../../../src/gcc/dwarf2out.c:32047 #7 0x0000000000daa210 in symbol_table::finalize_compilation_unit (this=0x7ffff730d100) at ../../../src/gcc/cgraphunit.c:2783
#8  0x0000000001417ec2 in compile_file () at ../../../src/gcc/toplev.c:480
#9  0x000000000141a90c in do_compile () at ../../../src/gcc/toplev.c:2170
#10 0x000000000141abf8 in toplev::main (this=0x7fffffffe56e, argc=8, argv=0x7fffffffe668) at ../../../src/gcc/toplev.c:2305 #11 0x000000000227731e in main (argc=8, argv=0x7fffffffe668) at ../../../src/gcc/main.c:39
(gdb)


--
Nathan Sidwell
2018-09-17  Nathan Sidwell  <nathan@acm.org>

	PR c++/87295
	* dwarf2out.c (clone_as_declaration): Copy die_id and set
	comdat_type_p as appropriate.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 264332)
+++ dwarf2out.c	(working copy)
@@ -8176,8 +8176,12 @@ clone_as_declaration (dw_die_ref die)
         }
     }
 
+  clone->die_id = die->die_id;
   if (die->comdat_type_p)
-    add_AT_die_ref (clone, DW_AT_signature, die);
+    {
+      clone->comdat_type_p = true;
+      add_AT_die_ref (clone, DW_AT_signature, die);
+    }
 
   add_AT_flag (clone, DW_AT_declaration, 1);
   return clone;
Index: testsuite/g++.dg/debug/pr87295.C
===================================================================
--- testsuite/g++.dg/debug/pr87295.C	(revision 0)
+++ testsuite/g++.dg/debug/pr87295.C	(working copy)
@@ -0,0 +1,20 @@
+// PR c++/87295 ICE in dwarf2out
+// { dg-options "-flto -ffat-lto-objects -fdebug-types-section -g -std=gnu++17" }
+
+template<typename _Tp, _Tp __v>
+struct integral_constant
+{
+  static constexpr _Tp value = __v;
+  typedef _Tp value_type;
+  constexpr operator value_type() const noexcept { return value; }
+};
+
+typedef integral_constant<bool, false> false_type;
+
+template<typename...>
+struct __or_;
+
+template<>
+struct __or_<>
+  : public false_type
+{ };

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]