This fixes PR51564 - we were streaming the TREE_ASM_WRITTEN flag for TYPE_DECLs as-is, confusing the ltrans stage dwarf2out.c which then only partly emit debug information, eventually ICEing at dwarf2out.c:19288.
The following patch does the same as we do for TYPE_Ps, stream that flag as false. It also adjusts the documentation in tree.h to mention the flag is used on TYPE_DECLs as well. I took the liberty to remove bogus flag references that refer to pre-tuples times. LTO bootstrapped and tested on x86_64-unknown-linux-gnu, a SPEC 2k6 build with -flto -g is still running. Committed to trunk. Richard. 2011-12-15 Richard Guenther <rguent...@suse.de> PR lto/51564 * tree.h (REGISTER_DEFS_IN_THIS_STMT, NECESSARY, STMT_IN_SSA_EDGE_WORKLIST): Remove no longer existing flag uses documentation. (TREE_ASM_WRITTEN): Update documentation to mention its use on TYPE_DECLs from debug info generation. * tree-streamer-out.c (pack_ts_base_value_fields): Stream TREE_ASM_WRITTEN as always zero for TYPE_DECLs, similar to all other types. * g++.dg/lto/pr51564-1_0.C: New testcase. Index: gcc/tree.h =================================================================== *** gcc/tree.h (revision 182360) --- gcc/tree.h (working copy) *************** struct GTY(()) tree_common { *** 644,662 **** DECL_UNSIGNED in all decls - REGISTER_DEFS_IN_THIS_STMT in - all expressions (tree-into-ssa.c) - asm_written_flag: TREE_ASM_WRITTEN in ! VAR_DECL, FUNCTION_DECL RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE BLOCK, SSA_NAME, STRING_CST - NECESSARY in - all expressions (tree-ssa-dce.c, tree-ssa-pre.c) - used_flag: TREE_USED in --- 644,656 ---- DECL_UNSIGNED in all decls asm_written_flag: TREE_ASM_WRITTEN in ! VAR_DECL, FUNCTION_DECL, TYPE_DECL RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE BLOCK, SSA_NAME, STRING_CST used_flag: TREE_USED in *************** struct GTY(()) tree_common { *** 685,693 **** IDENTIFIER_TRANSPARENT_ALIAS in IDENTIFIER_NODE - STMT_IN_SSA_EDGE_WORKLIST in - all expressions (tree-ssa-propagate.c) - visited: TREE_VISITED in --- 679,684 ---- *************** extern void omp_clause_range_check_faile *** 1369,1376 **** Nonzero in a FUNCTION_DECL means that the function has been compiled. This is interesting in an inline function, since it might not need to be compiled separately. ! Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ENUMERAL_TYPE ! if the debugging info for the type has been written. In a BLOCK node, nonzero if reorder_blocks has already seen this block. In an SSA_NAME node, nonzero if the SSA_NAME occurs in an abnormal PHI node. */ --- 1360,1367 ---- Nonzero in a FUNCTION_DECL means that the function has been compiled. This is interesting in an inline function, since it might not need to be compiled separately. ! Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ENUMERAL_TYPE ! or TYPE_DECL if the debugging info for the type has been written. In a BLOCK node, nonzero if reorder_blocks has already seen this block. In an SSA_NAME node, nonzero if the SSA_NAME occurs in an abnormal PHI node. */ Index: gcc/tree-streamer-out.c =================================================================== *** gcc/tree-streamer-out.c (revision 182360) --- gcc/tree-streamer-out.c (working copy) *************** pack_ts_base_value_fields (struct bitpac *** 88,94 **** else bp_pack_value (bp, 0, 1); /* We write debug info two times, do not confuse the second one. */ ! bp_pack_value (bp, TYPE_P (expr) ? 0 : TREE_ASM_WRITTEN (expr), 1); if (TYPE_P (expr)) bp_pack_value (bp, TYPE_ARTIFICIAL (expr), 1); else --- 88,95 ---- else bp_pack_value (bp, 0, 1); /* We write debug info two times, do not confuse the second one. */ ! bp_pack_value (bp, ((TYPE_P (expr) || TREE_CODE (expr) == TYPE_DECL) ! ? 0 : TREE_ASM_WRITTEN (expr)), 1); if (TYPE_P (expr)) bp_pack_value (bp, TYPE_ARTIFICIAL (expr), 1); else Index: gcc/testsuite/g++.dg/lto/pr51564-1_0.C =================================================================== *** gcc/testsuite/g++.dg/lto/pr51564-1_0.C (revision 0) --- gcc/testsuite/g++.dg/lto/pr51564-1_0.C (revision 0) *************** *** 0 **** --- 1,10 ---- + // { dg-lto-do link } + // { dg-lto-options { { -flto -g } } } + + typedef int T; + void foo(void) {} + int main() + { + foo(); + using ::T; + }