http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51262
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dodji at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-08
16:46:41 UTC ---
Program received signal SIGSEGV, Segmentation fault.
0x0000000000569d33 in primary_template_instantiation_p (t=0x7ffff5b8f930)
at /space/rguenther/src/svn/trunk/gcc/cp/pt.c:2874
2874 else if (CLASS_TYPE_P (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
(gdb)
but TYPE_NAME (t) is NULL:
(gdb) call debug_tree (t)
<union_type 0x7ffff5b8f930 sizes-gimplified type_5 type_6 DI
size <integer_cst 0x7ffff5a20f40 type <integer_type 0x7ffff5a390a8
bitsizetype> constant 64>
unit size <integer_cst 0x7ffff5a20f60 type <integer_type 0x7ffff5a39000
sizetype> constant 8>
align 64 symtab -173746304 alias set -1 canonical type 0x7ffff5b8f930
fields <field_decl 0x7ffff5b8c8e8 p
type <pointer_type 0x7ffff5a472a0 type <integer_type 0x7ffff5a395e8
int>
sizes-gimplified asm_written unsigned type_6 DI size <integer_cst
0x7ffff5a20f40 64> unit size <integer_cst 0x7ffff5a20f60 8>
align 64 symtab -173747024 alias set -1 canonical type
0x7ffff5a472a0>
used unsigned nonlocal decl_3 DI file t.C line 6 col 12 size
<integer_cst 0x7ffff5a20f40 64> unit size <integer_cst 0x7ffff5a20f60 8>
align 64 offset_align 128
offset <integer_cst 0x7ffff5a20f80 constant 0>
bit offset <integer_cst 0x7ffff5a20fe0 constant 0> context <union_type
0x7ffff5b8f930>> context <function_decl 0x7ffff5b8ef00 bar>
full-name "union<anonymous>"
X() X(constX&) this=(X&)
chain <type_decl 0x7ffff5ba52e0 ._0>>
cleared by the C++ free_lang_data langhook:
if (CP_AGGREGATE_TYPE_P (t)
&& TYPE_NAME (t))
{
tree name = TYPE_NAME (t);
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
/* Drop anonymous names. */
if (name != NULL_TREE
&& ANON_AGGRNAME_P (name))
TYPE_NAME (t) = NULL_TREE;
the type is anonymous before:
<union_type 0x7ffff5b8f930 ._0 sizes-gimplified type_5 type_6 DI
it's name:
<type_decl 0x7ffff5ba52e0 ._0
...
public decl_2 VOID file t.C line 5 col 5
align 8 context <function_decl 0x7ffff5b8ef00 bar> chain <var_decl
0x7ffff5a2c3c0 u>>
does not have DECL_LANG_FLAG_6 set (TYPE_DECL_ALIAS_P).
Dodji, Jason, can such anonymous name types ever have TYPE_DECL_ALIAS_P
set? Thus, is a valid fix
Index: pt.c
===================================================================
--- pt.c (revision 182117)
+++ pt.c (working copy)
@@ -2871,7 +2871,8 @@ primary_template_instantiation_p (const_
return DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INSTANTIATION (t)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t));
- else if (CLASS_TYPE_P (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
+ else if (CLASS_TYPE_P (t)
+ && TYPE_NAME (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
return CLASSTYPE_TEMPLATE_INSTANTIATION (t)
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t));
else if (TYPE_P (t)
?
Technically clearing the anonymous names is probably no longer necessary,
I'm testing a patch to remove that.