https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433
Bug ID: 61433 Summary: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Created attachment 32906 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32906&action=edit reduced testcase Compiler output (under valgrind): $ gcc -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra testcase.C ==2513== Invalid read of size 2 ==2513== at 0x7C4941: friend_accessible_p(tree_node*, tree_node*, tree_node*) (search.c:778) ==2513== by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool) (search.c:928) ==2513== by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool) (search.c:171) ==2513== by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*, int) (search.c:273) ==2513== by 0x79AE19: finish_class_member_access_expr(tree_node*, tree_node*, bool, int) (typeck.c:2755) ==2513== by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) (pt.c:15187) ==2513== by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*) (pt.c:12280) ==2513== by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*, tree_node*, tree_node*, int) (error.c:330) ==2513== by 0x73B815: decl_as_string(tree_node*, int) (error.c:2738) ==2513== by 0xDAE0E5: dump_function_header(_IO_FILE*, tree_node*, int) (tree-pretty-print.c:3454) ==2513== by 0xA3589E: (anonymous namespace)::pass_clean_state::execute(function*) (final.c:4605) ==2513== by 0xC17387: execute_one_pass(opt_pass*) (passes.c:2180) ==2513== by 0xC177B5: execute_pass_list_1(opt_pass*) (passes.c:2233) ==2513== by 0xC17808: execute_pass_list(function*, opt_pass*) (passes.c:2244) ==2513== by 0x94D6AF: expand_function(cgraph_node*) (cgraphunit.c:1787) ==2513== by 0x94F863: compile() (cgraphunit.c:1921) ==2513== by 0x94FF64: finalize_compilation_unit() (cgraphunit.c:2342) ==2513== by 0x72C2DE: cp_write_global_declarations() (decl2.c:4647) ==2513== by 0xD1245C: compile_file() (toplev.c:562) ==2513== by 0xD14494: toplev_main(int, char**) (toplev.c:1918) ==2513== by 0x5A46BF4: (below main) (in /lib64/libc-2.17.so) ==2513== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==2513== ==2513== ==2513== Process terminating with default action of signal 11 (SIGSEGV) ==2513== Access not within mapped region at address 0x0 ==2513== at 0x7C4941: friend_accessible_p(tree_node*, tree_node*, tree_node*) (search.c:778) ==2513== by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool) (search.c:928) ==2513== by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool) (search.c:171) ==2513== by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*, int) (search.c:273) ==2513== by 0x79AE19: finish_class_member_access_expr(tree_node*, tree_node*, bool, int) (typeck.c:2755) ==2513== by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) (pt.c:15187) ==2513== by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*) (pt.c:12280) ==2513== by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*, tree_node*, tree_node*, int) (error.c:330) ==2513== by 0x73B87E: decl_as_string_translate(tree_node*, int) (error.c:2746) ==2513== by 0x73AEA2: cp_diagnostic_starter(diagnostic_context*, diagnostic_info*) (error.c:3087) ==2513== by 0x15EA4B8: diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) (diagnostic.c:798) ==2513== by 0x15EB21F: internal_error(char const*, ...) (diagnostic.c:1136) ==2513== by 0xD123CF: crash_signal(int) (toplev.c:337) ==2513== by 0x5A5A5AF: ??? (in /lib64/libc-2.17.so) ==2513== by 0x7C4940: friend_accessible_p(tree_node*, tree_node*, tree_node*) (search.c:778) ==2513== by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool) (search.c:928) ==2513== by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool) (search.c:171) ==2513== by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*, int) (search.c:273) ==2513== by 0x79AE19: finish_class_member_access_expr(tree_node*, tree_node*, bool, int) (typeck.c:2755) ==2513== by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) (pt.c:15187) ==2513== by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*) (pt.c:12280) ==2513== by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*, tree_node*, tree_node*, int) (error.c:330) ==2513== by 0x73B815: decl_as_string(tree_node*, int) (error.c:2738) ==2513== by 0xDAE0E5: dump_function_header(_IO_FILE*, tree_node*, int) (tree-pretty-print.c:3454) ==2513== by 0xA3589E: (anonymous namespace)::pass_clean_state::execute(function*) (final.c:4605) ==2513== by 0xC17387: execute_one_pass(opt_pass*) (passes.c:2180) ==2513== by 0xC177B5: execute_pass_list_1(opt_pass*) (passes.c:2233) ==2513== by 0xC17808: execute_pass_list(function*, opt_pass*) (passes.c:2244) ==2513== by 0x94D6AF: expand_function(cgraph_node*) (cgraphunit.c:1787) ==2513== by 0x94F863: compile() (cgraphunit.c:1921) ==2513== by 0x94FF64: finalize_compilation_unit() (cgraphunit.c:2342) ==2513== by 0x72C2DE: cp_write_global_declarations() (decl2.c:4647) ==2513== by 0xD1245C: compile_file() (toplev.c:562) ==2513== by 0xD14494: toplev_main(int, char**) (toplev.c:1918) ==2513== by 0x5A46BF4: (below main) (in /lib64/libc-2.17.so)