http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53471
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-30
14:59:26 UTC ---
On the 4.7 branch I get this ICE triggered from
#1 0x000000000070af4f in comptypes (t1=0x7ffff2a4c3f0, t2=0x7ffff2dfab28,
strict=0) at /space/rguenther/src/svn/gcc-4_7-branch/gcc/cp/typeck.c:1393
1393 ("canonical types differ for identical types %T and %T",
thus another ICE. It happens because we call decl_assembler_name from
dwarf2out_finish, something we shouldn't do with the frontend langhooks
still in place.
#13 0x0000000000a6543f in dwarf2out_finish (filename=0x7fffffffe379 "t.ii")
at /space/rguenther/src/svn/gcc-4_7-branch/gcc/dwarf2out.c:22585
22585 if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
(gdb) l
22580 move_marked_base_types ();
22581
22582 for (node = deferred_asm_name; node; node = node->next)
22583 {
22584 tree decl = node->created_for;
22585 if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
22586 {
22587 add_linkage_attr (node->die, decl);
22588 move_linkage_attr (node->die);
22589 }
that's a general issue though. The issue is, this is a FUNCTION_DECL,
it qualifies for need_assembler_name_p but it doesn't have it set. Thus,
in
static void
free_lang_data_in_cgraph (void)
{
...
/* Find decls and types in the body of every function in the callgraph. */
for (n = cgraph_nodes; n; n = n->next)
find_decls_types_in_node (n, &fld);
...
/* Set the assembler name on every decl found. We need to do this
now because free_lang_data_in_decl will invalidate data needed
for mangling. This breaks mangling on interdependent decls. */
FOR_EACH_VEC_ELT (tree, fld.decls, i, t)
assign_assembler_name_if_neeeded (t);
we do not come along this FUNCTION_DECL. dwarf2out.c reaches it via
TYPE_METHODS which we clear. So we do not reach that type in walking
all types in free-lang-data. dwarf2out.c comes along it via
#12 0x0000000000d499d1 in rest_of_type_compilation (type=0x7ffff2e001f8,
toplev=1) at /space/rguenther/src/svn/gcc-4_7-branch/gcc/passes.c:238
238 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev);
(gdb) l
233 errors. */
234 if (seen_error ())
235 return;
236
237 timevar_push (TV_SYMOUT);
238 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev);
(gdb) up
#13 0x000000000065d4d0 in finish_struct_1 (t=0x7ffff2e001f8)
at /space/rguenther/src/svn/gcc-4_7-branch/gcc/cp/class.c:6133
6133 rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
thus explicitely pushes it.
I suppose rest_of_type_compilation could queue the type in a list later
processed by free-lang-data. Or we should not defer computation of
DECL_ASSEMBLER_NAME in dwarf2out.c here. Which I would like more.
Jason - do you remember why we do that?