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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|lto                         |debug
           Assignee|hubicka at gcc dot gnu.org         |unassigned at gcc dot 
gnu.org

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
This patch makes the bug to reproduce at compile time:
Index: ../../gcc/tree-streamer-out.c
===================================================================
--- ../../gcc/tree-streamer-out.c       (revision 232363)
+++ ../../gcc/tree-streamer-out.c       (working copy)
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.
 #include "alias.h"
 #include "stor-layout.h"
 #include "gomp-constants.h"
+#include "ipa-utils.h"


 /* Output the STRING constant to the string
@@ -308,6 +309,7 @@ pack_ts_function_decl_value_fields (stru
 static void
 pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
 {
+  odr_type_p (expr);
   /* for VECTOR_TYPE, TYPE_MODE reevaluates the mode using target_flags
      not necessary valid in a global context.
      Use the raw value previously set by layout_type.  */

We ICE because of sanity check that non-anonymous namespace does not have
DECL_ASSEMBLER_NAME "<anon>":

(gdb) l
250       if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
251           && DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)))
252         {
253           /* C++ FE uses magic <anon> as assembler names of anonymous
types.
254              verify that this match with type_in_anonymous_namespace_p.  */
255           gcc_checking_assert (strcmp ("<anon>",
256                                           IDENTIFIER_POINTER
257                                             (DECL_ASSEMBLER_NAME (TYPE_NAME
(t)))));

(gdb) p debug_tree (t->type_common.name->decl_with_vis.assembler_name)
 <identifier_node 0x7ffff6c45aa8 <anon> bindings <(nil)> local bindings
<(nil)>>

This is set:

#0  mangle_decl (decl=0x7ffff6c31720) at ../../gcc/cp/mangle.c:3602
#1  0x0000000001363c10 in decl_assembler_name (decl=0x7ffff6c31720) at
../../gcc/tree.c:668
#2  0x0000000000c01d63 in add_linkage_attr (die=0x7ffff6b010a0,
decl=0x7ffff6c31720) at ../../gcc/dwarf2out.c:18541
#3  0x0000000000c0c606 in gen_typedef_die (decl=0x7ffff6c31720,
context_die=0x7ffff6b01050) at ../../gcc/dwarf2out.c:22421
#4  0x0000000000c0f3b8 in gen_decl_die (decl=0x7ffff6c31720, origin=0x0,
ctx=0x0, context_die=0x7ffff6b01050) at ../../gcc/dwarf2out.c:23319
#5  0x0000000000c0cea5 in gen_type_die_with_usage (type=0x7ffff6c30348,
context_die=0x7ffff6b01050, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22568
#6  0x0000000000c0d5a5 in gen_type_die (type=0x7ffff6c30348,
context_die=0x7ffff6b01050) at ../../gcc/dwarf2out.c:22725
#7  0x0000000000c0f3a0 in gen_decl_die (decl=0x7ffff6c31558, origin=0x0,
ctx=0x7fffffffdee0, context_die=0x7ffff6b01050) at ../../gcc/dwarf2out.c:23316
#8  0x0000000000c0b7d1 in gen_member_die (type=0x7ffff6c30f18,
context_die=0x7ffff6b01050) at ../../gcc/dwarf2out.c:22198
#9  0x0000000000c0c04f in gen_struct_or_union_type_die (type=0x7ffff6c30f18,
context_die=0x7ffff6b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22304
#10 0x0000000000c0ca4c in gen_tagged_type_die (type=0x7ffff6c30f18,
context_die=0x7ffff6b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22505
#11 0x0000000000c0d22d in gen_type_die_with_usage (type=0x7ffff6c30f18,
context_die=0x7ffff6b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22670
#12 0x0000000000c0d5a5 in gen_type_die (type=0x7ffff6c30f18,
context_die=0x7ffff6b01000) at ../../gcc/dwarf2out.c:22725
#13 0x0000000000c0f3a0 in gen_decl_die (decl=0x7ffff6c31390, origin=0x0,
ctx=0x0, context_die=0x7ffff6b01000) at ../../gcc/dwarf2out.c:23316
#14 0x0000000000c1054e in dwarf2out_decl (decl=0x7ffff6c31390) at
../../gcc/dwarf2out.c:23776
#15 0x0000000000c0fa09 in dwarf2out_type_decl (decl=0x7ffff6c31390, local=0) at
../../gcc/dwarf2out.c:23486
#16 0x0000000000f2b4af in rest_of_type_compilation (type=0x7ffff6c30f18,
toplev=1) at ../../gcc/passes.c:335
#17 0x000000000086faee in finish_struct_1 (t=0x7ffff6c30f18) at
../../gcc/cp/class.c:7037
#18 0x0000000000870ab7 in finish_struct (t=0x7ffff6c30f18, attributes=0x0) at
../../gcc/cp/class.c:7203
#19 0x00000000008d0ff9 in cp_parser_class_specifier_1 (parser=0x7ffff7ff8ab0)
at ../../gcc/cp/parser.c:21269
#20 0x00000000008d1c40 in cp_parser_class_specifier (parser=0x7ffff7ff8ab0) at
../../gcc/cp/parser.c:21497
#21 0x00000000008c6c2c in cp_parser_type_specifier (parser=0x7ffff7ff8ab0,
flags=1, decl_specs=0x7fffffffe780, is_declaration=true,
declares_class_or_enum=0x7fffffffe6f4, 
    is_cv_qualifier=0x7fffffffe6f3) at ../../gcc/cp/parser.c:15795
#22 0x00000000008c1c31 in cp_parser_decl_specifier_seq (parser=0x7ffff7ff8ab0,
flags=1, decl_specs=0x7fffffffe780, declares_class_or_enum=0x7fffffffe824) at
../../gcc/cp/parser.c:12716
#23 0x00000000008c11e2 in cp_parser_simple_declaration (parser=0x7ffff7ff8ab0,
function_definition_allowed_p=true, maybe_range_for_decl=0x0) at
../../gcc/cp/parser.c:12259
#24 0x00000000008c1170 in cp_parser_block_declaration (parser=0x7ffff7ff8ab0,
statement_p=false) at ../../gcc/cp/parser.c:12206
#25 0x00000000008c0eea in cp_parser_declaration (parser=0x7ffff7ff8ab0) at
../../gcc/cp/parser.c:12103
#26 0x00000000008c09f5 in cp_parser_declaration_seq_opt (parser=0x7ffff7ff8ab0)
at ../../gcc/cp/parser.c:11982
#27 0x00000000008b070e in cp_parser_translation_unit (parser=0x7ffff7ff8ab0) at
../../gcc/cp/parser.c:4299
#28 0x0000000000901be5 in c_parse_file () at ../../gcc/cp/parser.c:37341
#29 0x0000000000aa5ecf in c_common_parse_file () at
../../gcc/c-family/c-opts.c:1064
#30 0x000000000104fdf0 in compile_file () at ../../gcc/toplev.c:464
#31 0x00000000010523db in do_compile () at ../../gcc/toplev.c:1985
#32 0x0000000001052654 in toplev::main (this=0x7fffffffea90, argc=6,
argv=0x7fffffffeb98) at ../../gcc/toplev.c:2092
#33 0x0000000001add69a in main (argc=6, argv=0x7fffffffeb98) at
../../gcc/main.c:39

which is executed too early. Later the type is finalized and becomes
non-anonymous.

So I am changing component to debug. I am sure I was commenting on this bug
twice before, but can't find the dups.

Reply via email to