http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56819
Bug #: 56819 Summary: [4.7/4.8/4.9 Regression] ICE: SIGSEGV in int_cst_value (tree.h:4013) with -fcompare-debug Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz Created attachment 29780 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29780 reduced testcase This ICE happens quite often when running the testsuite with -fcompare-debug Compiler output: $ gcc -fcompare-debug testcase.C -wrapper valgrind,-q,--num-callers=40,--track-origins=yes ==26928== Invalid read of size 2 ==26928== at 0xDC0984: int_cst_value(tree_node const*) (tree.h:4013) ==26928== by 0x67D124: get_non_default_template_args_count(tree_node*, int) (error.c:181) ==26928== by 0x685548: dump_template_argument_list(tree_node*, int) (error.c:190) ==26928== by 0x67F24F: dump_decl(tree_node*, int) (error.c:1135) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x685C0A: dump_typename(tree_node*, int) (error.c:569) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x67E2F5: dump_type_prefix(tree_node*, int) (error.c:783) ==26928== by 0x68841B: dump_function_decl(tree_node*, int) (error.c:1406) ==26928== by 0x689D60: decl_as_string(tree_node*, int) (error.c:2613) ==26928== by 0x730E22: cxx_printable_name_internal(tree_node*, int, bool) (tree.c:1879) ==26928== by 0xC5BE38: dump_function_header(_IO_FILE*, tree_node*, int) (tree-pretty-print.c:3138) ==26928== by 0x943DFF: rest_of_clean_state() (final.c:4456) ==26928== by 0xAE2457: execute_one_pass(opt_pass*) (passes.c:2330) ==26928== by 0xAE2864: execute_pass_list(opt_pass*) (passes.c:2378) ==26928== by 0x8650B1: expand_function(cgraph_node*) (cgraphunit.c:1640) ==26928== by 0x86724D: compile() (cgraphunit.c:1833) ==26928== by 0x867509: finalize_compilation_unit() (cgraphunit.c:2119) ==26928== by 0x67C59E: cp_write_global_declarations() (decl2.c:4312) ==26928== by 0xBC9A1C: compile_file() (toplev.c:557) ==26928== by 0xBCB837: toplev_main(int, char**) (toplev.c:1864) ==26928== by 0x5A3C60C: (below main) (in /lib64/libc-2.15.so) ==26928== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==26928== ==26928== ==26928== Process terminating with default action of signal 11 (SIGSEGV) ==26928== Access not within mapped region at address 0x0 ==26928== at 0xDC0984: int_cst_value(tree_node const*) (tree.h:4013) ==26928== by 0x67D124: get_non_default_template_args_count(tree_node*, int) (error.c:181) ==26928== by 0x685548: dump_template_argument_list(tree_node*, int) (error.c:190) ==26928== by 0x67F24F: dump_decl(tree_node*, int) (error.c:1135) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x685C0A: dump_typename(tree_node*, int) (error.c:569) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x67E2F5: dump_type_prefix(tree_node*, int) (error.c:783) ==26928== by 0x68841B: dump_function_decl(tree_node*, int) (error.c:1406) ==26928== by 0x689DB9: decl_as_string_translate(tree_node*, int) (error.c:2621) ==26928== by 0x730E22: cxx_printable_name_internal(tree_node*, int, bool) (tree.c:1879) ==26928== by 0x6892AA: cp_diagnostic_starter(diagnostic_context*, diagnostic_info*) (error.c:2959) ==26928== by 0x13505D2: diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) (diagnostic.c:759) ==26928== by 0x135141F: internal_error(char const*, ...) (diagnostic.c:1097) ==26928== by 0xBC99AF: crash_signal(int) (toplev.c:332) ==26928== by 0x5A4FC4F: ??? (in /lib64/libc-2.15.so) ==26928== by 0xDC0983: int_cst_value(tree_node const*) (tree.c:10247) ==26928== by 0x6336C07: ??? ==26928== by 0x67D124: get_non_default_template_args_count(tree_node*, int) (error.c:181) ==26928== by 0x685548: dump_template_argument_list(tree_node*, int) (error.c:190) ==26928== by 0x67F24F: dump_decl(tree_node*, int) (error.c:1135) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x685C0A: dump_typename(tree_node*, int) (error.c:569) ==26928== by 0x68590A: dump_template_parms(tree_node*, int, int) (error.c:1647) ==26928== by 0x67E2F5: dump_type_prefix(tree_node*, int) (error.c:783) ==26928== by 0x68841B: dump_function_decl(tree_node*, int) (error.c:1406) ==26928== by 0x689D60: decl_as_string(tree_node*, int) (error.c:2613) ==26928== by 0x730E22: cxx_printable_name_internal(tree_node*, int, bool) (tree.c:1879) ==26928== by 0xC5BE38: dump_function_header(_IO_FILE*, tree_node*, int) (tree-pretty-print.c:3138) ==26928== by 0x943DFF: rest_of_clean_state() (final.c:4456) ==26928== by 0xAE2457: execute_one_pass(opt_pass*) (passes.c:2330) ==26928== by 0xAE2864: execute_pass_list(opt_pass*) (passes.c:2378) ==26928== by 0x8650B1: expand_function(cgraph_node*) (cgraphunit.c:1640) ==26928== by 0x86724D: compile() (cgraphunit.c:1833) ==26928== by 0x867509: finalize_compilation_unit() (cgraphunit.c:2119) ==26928== by 0x67C59E: cp_write_global_declarations() (decl2.c:4312) ==26928== by 0xBC9A1C: compile_file() (toplev.c:557) ==26928== by 0xBCB837: toplev_main(int, char**) (toplev.c:1864) ==26928== by 0x5A3C60C: (below main) (in /lib64/libc-2.15.so) ==26928== If you believe this happened as a result of a stack ==26928== overflow in your program's main thread (unlikely but ==26928== possible), you can try to increase the size of the ==26928== main thread stack using the --main-stacksize= flag. ==26928== The main thread stack size used in this run was 16777216. gcc: internal compiler error: Segmentation fault (program valgrind) 0x40ce5c execute /mnt/svn/gcc-trunk/gcc/gcc.c:2822 0x40d0b9 do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:4614 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 0x40db4a do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5268 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 0x40db4a do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5268 0x40df3b do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5373 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 0x40db4a do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5268 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 0x40db4a do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5268 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 0x40db4a do_spec_1 /mnt/svn/gcc-trunk/gcc/gcc.c:5268 0x40fe29 process_brace_body /mnt/svn/gcc-trunk/gcc/gcc.c:5871 0x40fe29 handle_braces /mnt/svn/gcc-trunk/gcc/gcc.c:5785 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r197309 - crash 4.8 r196898 - crash 4.7 r196898 - crash 4.6 r196898 - OK