http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-11
15:00:09 UTC ---
What happens is that the input at LTRANS stage has wrecked TYPE_MAIN_VARIANT:
(gdb) call debug_tree ($31)
<integer_type 0x7ffff692a348 wchar_t readonly SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff6912880 -2147483648> max <integer_cst 0x7ffff6912a40
2147483647>>
(gdb) p $31->type_common.main_variant
$32 = (tree) 0x7ffff6924540
(gdb) call debug_tree ($32)
<integer_type 0x7ffff6924540 wchar_t SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647> context <translation_unit_decl 0x7ffff6927170 D.2440>>
(gdb) p $31->type_common.main_variant->type_common.main_variant
$33 = (tree) 0x7ffff67f05e8
(gdb) call debug_tree ($33)
<integer_type 0x7ffff67f05e8 int public SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32
min <integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647>
pointer_to_this <pointer_type 0x7ffff67f82a0>>
thus a TYPE_MAIN_VARIANT of a main variant is not itself. The code
cannot deal with this impossible situation. Thus,
TYPE_MAIN_VARIANT (t) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (t))
needs to always hold.
It might be that things break here because $33 is integer_type_node, a
type we pre-load into the streamer cache.
More investigation needed.