http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51262
Bug #: 51262 Summary: [4.7 Regression] ICE: SIGSEGV in primary_template_instantiation_p (pt.c:2874) with -flto -g Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 25875 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25875 reduced testcase Compiler output: $ gcc -flto -fcompare-debug testcase.C ==20321== Invalid read of size 2 ==20321== at 0x5C0904: primary_template_instantiation_p(tree_node const*) (pt.c:2874) ==20321== by 0x5C118D: get_primary_template_innermost_parameters(tree_node const*) (pt.c:2902) ==20321== by 0x899E19: gen_tagged_type_die(tree_node*, die_struct*, debug_info_usage) (dwarf2out.c:20045) ==20321== by 0x886C5F: gen_type_die_with_usage(tree_node*, die_struct*, debug_info_usage) (dwarf2out.c:18952) ==20321== by 0x89C8A6: gen_decl_die(tree_node*, tree_node*, die_struct*) (dwarf2out.c:19512) ==20321== by 0x8A1C2F: decls_for_scope(tree_node*, die_struct*, int) (dwarf2out.c:19125) ==20321== by 0x8A2043: gen_block_die(tree_node*, die_struct*, int) (dwarf2out.c:18111) ==20321== by 0x8A1CD5: decls_for_scope(tree_node*, die_struct*, int) (dwarf2out.c:19139) ==20321== by 0x89DB1E: gen_subprogram_die(tree_node*, die_struct*) (dwarf2out.c:17555) ==20321== by 0x89C214: gen_decl_die(tree_node*, tree_node*, die_struct*) (dwarf2out.c:19489) ==20321== by 0x8A5818: dwarf2out_function_decl(tree_node*) (dwarf2out.c:19871) ==20321== by 0x8FEF14: rest_of_handle_final() (final.c:4349) ==20321== by 0xA6ED94: execute_one_pass(opt_pass*) (passes.c:2074) ==20321== by 0xA6F134: execute_pass_list(opt_pass*) (passes.c:2129) ==20321== by 0xA6F146: execute_pass_list(opt_pass*) (passes.c:2130) ==20321== by 0xA6F146: execute_pass_list(opt_pass*) (passes.c:2130) ==20321== by 0xBD0CED: tree_rest_of_compilation(tree_node*) (tree-optimize.c:420) ==20321== by 0x8249C9: cgraph_expand_function(cgraph_node*) (cgraphunit.c:1819) ==20321== by 0x826B05: cgraph_optimize() (cgraphunit.c:1984) ==20321== by 0x826ED9: cgraph_finalize_compilation_unit() (cgraphunit.c:1327) ==20321== by 0x64880A: cp_write_global_declarations() (decl2.c:4050) ==20321== by 0xB64033: toplev_main(int, char**) (toplev.c:581) ==20321== by 0x674ED2C: (below main) (in /lib64/libc-2.12.2.so) ==20321== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==20321== testcase.C: In function 'bar<void>(int*)void*': testcase.C:11:1: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. gcc: error: during -fcompare-debug recompilation gcc: error: testcase.C: -fcompare-debug failure (length) Tested revisions: r181550 - crash r181532 - crash r181508 - crash r181442 - OK