[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Richard Biener  ---
Should be fixed.

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Fri Jan 15 15:37:38 2016
New Revision: 232434

URL: https://gcc.gnu.org/viewcvs?rev=232434=gcc=rev
Log:
2016-01-15  Richard Biener  

PR debug/69137
* dwarf2out.c (add_linkage_name_raw): New function split out from ...
(add_linkage_name): ... here.
(gen_typedef_die): Use add_linkage_name_raw instead of
add_linkage_attr to delay DECL_ASSEMBLER_NAME computation
if necessary.

* g++.dg/lto/pr69137_0.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/lto/pr69137_0.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c
trunk/gcc/testsuite/ChangeLog

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

--- Comment #7 from Richard Biener  ---
Created attachment 37352
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37352=edit
patch

Patch I am testing.

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-14 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

Jan Hubicka  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  ---
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 "":

(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  as assembler names of anonymous
types.
254  verify that this match with type_in_anonymous_namespace_p.  */
255   gcc_checking_assert (strcmp ("",
256   IDENTIFIER_POINTER
257 (DECL_ASSEMBLER_NAME (TYPE_NAME
(t);

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

This is set:

#0  mangle_decl (decl=0x76c31720) at ../../gcc/cp/mangle.c:3602
#1  0x01363c10 in decl_assembler_name (decl=0x76c31720) at
../../gcc/tree.c:668
#2  0x00c01d63 in add_linkage_attr (die=0x76b010a0,
decl=0x76c31720) at ../../gcc/dwarf2out.c:18541
#3  0x00c0c606 in gen_typedef_die (decl=0x76c31720,
context_die=0x76b01050) at ../../gcc/dwarf2out.c:22421
#4  0x00c0f3b8 in gen_decl_die (decl=0x76c31720, origin=0x0,
ctx=0x0, context_die=0x76b01050) at ../../gcc/dwarf2out.c:23319
#5  0x00c0cea5 in gen_type_die_with_usage (type=0x76c30348,
context_die=0x76b01050, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22568
#6  0x00c0d5a5 in gen_type_die (type=0x76c30348,
context_die=0x76b01050) at ../../gcc/dwarf2out.c:22725
#7  0x00c0f3a0 in gen_decl_die (decl=0x76c31558, origin=0x0,
ctx=0x7fffdee0, context_die=0x76b01050) at ../../gcc/dwarf2out.c:23316
#8  0x00c0b7d1 in gen_member_die (type=0x76c30f18,
context_die=0x76b01050) at ../../gcc/dwarf2out.c:22198
#9  0x00c0c04f in gen_struct_or_union_type_die (type=0x76c30f18,
context_die=0x76b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22304
#10 0x00c0ca4c in gen_tagged_type_die (type=0x76c30f18,
context_die=0x76b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22505
#11 0x00c0d22d in gen_type_die_with_usage (type=0x76c30f18,
context_die=0x76b01000, usage=DINFO_USAGE_DIR_USE) at
../../gcc/dwarf2out.c:22670
#12 0x00c0d5a5 in gen_type_die (type=0x76c30f18,
context_die=0x76b01000) at ../../gcc/dwarf2out.c:22725
#13 0x00c0f3a0 in gen_decl_die (decl=0x76c31390, origin=0x0,
ctx=0x0, context_die=0x76b01000) at ../../gcc/dwarf2out.c:23316
#14 0x00c1054e in dwarf2out_decl (decl=0x76c31390) at
../../gcc/dwarf2out.c:23776
#15 0x00c0fa09 in dwarf2out_type_decl (decl=0x76c31390, local=0) at
../../gcc/dwarf2out.c:23486
#16 0x00f2b4af in rest_of_type_compilation (type=0x76c30f18,
toplev=1) at ../../gcc/passes.c:335
#17 0x0086faee in finish_struct_1 (t=0x76c30f18) at
../../gcc/cp/class.c:7037
#18 0x00870ab7 in finish_struct (t=0x76c30f18, attributes=0x0) at
../../gcc/cp/class.c:7203
#19 0x008d0ff9 in cp_parser_class_specifier_1 (parser=0x77ff8ab0)
at ../../gcc/cp/parser.c:21269
#20 0x008d1c40 in cp_parser_class_specifier (parser=0x77ff8ab0) at
../../gcc/cp/parser.c:21497
#21 0x008c6c2c in cp_parser_type_specifier (parser=0x77ff8ab0,
flags=1, decl_specs=0x7fffe780, is_declaration=true,
declares_class_or_enum=0x7fffe6f4, 
is_cv_qualifier=0x7fffe6f3) at ../../gcc/cp/parser.c:15795
#22 0x008c1c31 in cp_parser_decl_specifier_seq (parser=0x77ff8ab0,
flags=1, decl_specs=0x7fffe780, declares_class_or_enum=0x7fffe824) at
../../gcc/cp/parser.c:12716
#23 0x008c11e2 in cp_parser_simple_declaration (parser=0x77ff8ab0,

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-14 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

Jan Hubicka  changed:

   What|Removed |Added

 CC||rai...@emrich-ebersheim.de

--- Comment #4 from Jan Hubicka  ---
*** Bug 67289 has been marked as a duplicate of this bug. ***

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-14 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

Jan Hubicka  changed:

   What|Removed |Added

 CC||aldyh at redhat dot com,
   ||hubicka at gcc dot gnu.org,
   ||jason at redhat dot com,
   ||rguenther at suse dot de

--- Comment #5 from Jan Hubicka  ---
Finally found the dup PR. It seems it does not have really useful log there
anyway.
Jason/Aldy/Richard, the issue is that early debug now computes assemblernames
too early. I unassigned myself and hope one of you will know the proper fix.

Either C++ FE should call the debug hooks later, once all the types referred
are in final form (which I guess is a correct solution, producing DIE for
unfinished type seems like bad idea) or add_linkage_name should be extended to
handle delaying of assembler name computation for TYPE_DECL.

[Bug debug/69137] [6 Regression] ICE in odr_type_p, at ipa-utils.h:257

2016-01-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69137

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #6 from Richard Biener  ---
I will have a look.