http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46977
Summary: [4.6 Regression] [C++0x] ICE: SIGSEGV in htab_find_slot_with_hash (hashtab.c:650) Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz ------- testcase.C -------- template < typename > void foo () { ({int i;}), 0; } --------------------------- Compiler output: $ gcc -std=gnu++0x testcase.C ==24355== Invalid read of size 8 ==24355== at 0x11EE1E7: htab_find_slot_with_hash (hashtab.c:650) ==24355== by 0x540147: register_local_specialization (pt.c:1679) ==24355== by 0x56ACB0: tsubst_decl (pt.c:10050) ==24355== by 0x5632F7: tsubst (pt.c:10371) ==24355== by 0x55358B: tsubst_expr (pt.c:11992) ==24355== by 0x5534F8: tsubst_expr (pt.c:12120) ==24355== by 0x55DEEA: tsubst_copy_and_build (pt.c:13266) ==24355== by 0x55EA64: tsubst_copy_and_build (pt.c:12782) ==24355== by 0x5623E4: fold_non_dependent_expr_sfinae (pt.c:5168) ==24355== by 0x4FFCB8: null_ptr_cst_p (call.c:518) ==24355== by 0x54AA0D: build_non_dependent_expr (pt.c:18721) ==24355== by 0x62D7A0: finish_expr_stmt (semantics.c:633) ==24355== Address 0x20 is not stack'd, malloc'd or (recently) free'd ==24355== testcase.C: In function 'void foo()': testcase.C:4:9: 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. GDB: Program received signal SIGSEGV, Segmentation fault. htab_find_slot_with_hash (htab=0x0, element=0x7ffff7eea1e0, hash=4278047804, insert=INSERT) at /mnt/svn/gcc-trunk/libiberty/hashtab.c:650 650 size = htab_size (htab); (gdb) bt #0 htab_find_slot_with_hash (htab=0x0, element=0x7ffff7eea1e0, hash=4278047804, insert=INSERT) at /mnt/svn/gcc-trunk/libiberty/hashtab.c:650 #1 0x0000000000540148 in register_local_specialization (spec=0x7ffff7eea280, tmpl=0x7ffff7eea1e0) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:1679 #2 0x000000000056acb1 in tsubst_decl (t=0x7ffff7eea1e0, args=0x0, complain=1) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:10050 #3 0x00000000005632f8 in tsubst (t=0x7ffff7eea1e0, args=0x0, complain=1, in_decl=0x0) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:10371 #4 0x000000000055358c in tsubst_expr (t=<value optimized out>, args=0x0, complain=1, in_decl=0x0, integral_constant_expression_p=1 '\001') at /mnt/svn/gcc-trunk/gcc/cp/pt.c:11992 #5 0x00000000005534f9 in tsubst_expr (t=0x7ffff5d04800, args=0x0, complain=1, in_decl=0x0, integral_constant_expression_p=1 '\001') at /mnt/svn/gcc-trunk/gcc/cp/pt.c:12120 #6 0x000000000055deeb in tsubst_copy_and_build (t=0x7ffff7ecb990, args=0x0, complain=1, in_decl=0x0, function_p=<value optimized out>, integral_constant_expression_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:13266 #7 0x000000000055ea65 in tsubst_copy_and_build (t=0x7ffff7ff90a8, args=0x0, complain=1, in_decl=0x0, function_p=<value optimized out>, integral_constant_expression_p=1 '\001') at /mnt/svn/gcc-trunk/gcc/cp/pt.c:12782 #8 0x00000000005623e5 in fold_non_dependent_expr_sfinae (expr=0x7ffff7ff90a8, complain=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:5168 #9 0x00000000004ffcb9 in null_ptr_cst_p (t=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/call.c:518 #10 0x000000000054aa0e in build_non_dependent_expr (expr=0x7ffff7ff90a8) at /mnt/svn/gcc-trunk/gcc/cp/pt.c:18721 #11 0x000000000062d7a1 in finish_expr_stmt (expr=0x7ffff7ff90a8) at /mnt/svn/gcc-trunk/gcc/cp/semantics.c:633 #12 0x00000000005cc470 in cp_parser_statement (parser=0x7ffff5d27000, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8130 #13 0x00000000005cd7b6 in cp_parser_statement_seq_opt (parser=0x7ffff5d27000, in_statement_expr=0x0) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8379 #14 0x00000000005cd8ec in cp_parser_compound_statement (parser=0x7ffff5d27000, in_statement_expr=0x0, in_try=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8333 #15 0x00000000005e2abc in cp_parser_function_body (parser=0x7ffff5d27000) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:16320 #16 cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff5d27000) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:16357 #17 0x00000000005e3302 in cp_parser_function_definition_after_declarator (parser=0x7ffff5d27000, inline_p=0 '\000') at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19749 #18 0x00000000005e4aec in cp_parser_function_definition_from_specifiers_and_declarator (parser=0x7ffff5d27000, decl_specifiers=0x7fffffffd880, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd8ef "\001") at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19678 #19 cp_parser_init_declarator (parser=0x7ffff5d27000, decl_specifiers=0x7fffffffd880, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd8ef "\001") at /mnt/svn/gcc-trunk/gcc/cp/parser.c:14467 #20 0x00000000005e9b5c in cp_parser_single_declaration (parser=0x7ffff5d27000, checks=0x0, member_p=0 '\000', explicit_specialization_p=0 '\000', friend_p=0x7fffffffd94f "") at /mnt/svn/gcc-trunk/gcc/cp/parser.c:20003 #21 0x00000000005e9e85 in cp_parser_template_declaration_after_export (parser=0x7ffff5d27000, member_p=0 '\000') at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19853 #22 0x00000000005eebba in cp_parser_declaration (parser=0x7ffff5d27000) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9408 #23 cp_parser_declaration (parser=0x7ffff5d27000) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9359 #24 0x00000000005ed26a in cp_parser_declaration_seq_opt (parser=0x7ffff5d27000) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9338 #25 0x00000000005eef55 in cp_parser_translation_unit () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:3455 #26 c_parse_file () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:25147 #27 0x00000000006c3185 in c_common_parse_file () at /mnt/svn/gcc-trunk/gcc/c-family/c-opts.c:1071 #28 0x0000000000a1fe08 in compile_file (argc=14, argv=0x7fffffffdba8) at /mnt/svn/gcc-trunk/gcc/toplev.c:579 #29 do_compile (argc=14, argv=0x7fffffffdba8) at /mnt/svn/gcc-trunk/gcc/toplev.c:1874 #30 toplev_main (argc=14, argv=0x7fffffffdba8) at /mnt/svn/gcc-trunk/gcc/toplev.c:1937 #31 0x00007ffff6586bbd in __libc_start_main () from /lib/libc.so.6 #32 0x00000000004fd929 in _start () Tested revisions: r167809 - crash r167723 - crash r165699 - OK 4.5 r166509 - OK