https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65626
Bug ID: 65626 Summary: [5 Regression] ICE in fixup_noreturn_call called by tree-ssa-forwprop.c:2492 Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Starting from r221409, GCC produces ICE on following code: $ cat /home/marxin/Programming/mosesdecoder/1.ii class A { virtual unsigned long m_fn1() const; virtual int &m_fn2(unsigned long) const; }; class C : A { public: int &m_fn2(unsigned long) const; unsigned long m_fn1() const; }; class B { void m_fn3(const A &, const int &, const C &, int &) const; }; void B::m_fn3(const A &, const int &, const C &, int &) const { C &a(a); for (long b = 0; a.m_fn1(); b++) a.m_fn2(0); } $ ./xgcc -B . /home/marxin/Programming/mosesdecoder/1.ii -c -O2 /home/marxin/Programming/mosesdecoder/1.ii: In member function ‘void B::m_fn3(const A&, const int&, const C&, int&) const’: /home/marxin/Programming/mosesdecoder/1.ii:17:1: internal compiler error: Segmentation fault } ^ 0xd8c428 crash_signal ../../gcc/toplev.c:383 0xdd5b35 bb_seq_addr ../../gcc/gimple.h:1535 0xdd5ff6 gsi_last_bb ../../gcc/gimple-iterator.h:162 0xdd7726 fixup_noreturn_call(gimple_statement_base*) ../../gcc/tree-cfgcleanup.c:594 0xeb4c9d execute ../../gcc/tree-ssa-forwprop.c:2492 │585 bool │586 fixup_noreturn_call (gimple stmt) │587 { B+ │588 basic_block bb = gimple_bb (stmt); │589 >│590 if (gimple_call_builtin_p (stmt, BUILT_IN_RETURN)) │591 return false; Here bb == NULL, which is set here: Old value = -154917976 New value = 0 gimple_set_bb (stmt=0x7ffff6da9a80, bb=0x0) at ../../gcc/gimple.c:1544 1544 if (gimple_code (stmt) != GIMPLE_LABEL) (gdb) bt #0 gimple_set_bb (stmt=0x7ffff6da9a80, bb=0x0) at ../../gcc/gimple.c:1544 #1 0x0000000000a9f5a3 in gsi_remove (i=0x7fffffffd290, remove_permanently=true) at ../../gcc/gimple-iterator.c:595 #2 0x0000000000dc4299 in remove_bb (bb=0x7ffff6c423a8) at ../../gcc/tree-cfg.c:2129 #3 0x00000000009206ad in delete_basic_block (bb=0x7ffff6c423a8) at ../../gcc/cfghooks.c:585 #4 0x0000000000dd199d in remove_edge_and_dominated_blocks (e=0x7ffff6c43348) at ../../gcc/tree-cfg.c:7905 #5 0x0000000000dd6525 in remove_fallthru_edge (ev=0x7ffff6db6050) at ../../gcc/tree-cfgcleanup.c:107 #6 0x0000000000dd78ad in fixup_noreturn_call (stmt=0x7ffff6da9b00) at ../../gcc/tree-cfgcleanup.c:631 #7 0x0000000000eb4c9e in (anonymous namespace)::pass_forwprop::execute (this=0x20d5ee0, fun=0x7ffff6db0000) at ../../gcc/tree-ssa-forwprop.c:2492 #8 0x0000000000ca3d80 in execute_one_pass (pass=0x20d5ee0) at ../../gcc/passes.c:2328 #9 0x0000000000ca3fba in execute_pass_list_1 (pass=0x20d5ee0) at ../../gcc/passes.c:2380 #10 0x0000000000ca3feb in execute_pass_list_1 (pass=0x20d5d60) at ../../gcc/passes.c:2381 #11 0x0000000000ca4028 in execute_pass_list (fn=0x7ffff6db0000, pass=0x20d5be0) at ../../gcc/passes.c:2391 #12 0x0000000000ca29c6 in do_per_function_toporder (callback=0xca4000 <execute_pass_list(function*, opt_pass*)>, data=0x20d5be0) at ../../gcc/passes.c:1726 #13 0x0000000000ca4bbd in execute_ipa_pass_list (pass=0x20d5b80) at ../../gcc/passes.c:2734 #14 0x00000000009555c5 in ipa_passes () at ../../gcc/cgraphunit.c:2154 #15 0x00000000009559bd in symbol_table::compile (this=0x7ffff6c3b000) at ../../gcc/cgraphunit.c:2295 #16 0x0000000000955c32 in symbol_table::finalize_compilation_unit (this=0x7ffff6c3b000) at ../../gcc/cgraphunit.c:2444 #17 0x0000000000765803 in cp_write_global_declarations () at ../../gcc/cp/decl2.c:4754 #18 0x0000000000d8ca61 in compile_file () at ../../gcc/toplev.c:608 #19 0x0000000000d8ee5a in do_compile () at ../../gcc/toplev.c:2076 #20 0x0000000000d8f086 in toplev::main (this=0x7fffffffd990, argc=13, argv=0x7fffffffda98) at ../../gcc/toplev.c:2174 #21 0x000000000160d2cc in main (argc=13, argv=0x7fffffffda98) at ../../gcc/main.c:39 Thanks, Martin