http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59255

--- Comment #2 from mark at jarv dot in ---
This is my first time trying to debug GCC, so please forgive me if this is
obvious or unhelpful.

I traced this in GDB and it seems that the segfault is because the
FOR_EACH_EDGE loop at value-prof.c:1281 runs off the end of the icall_bb->succs
vector without identifying an edge with the EDGE_EH flag set.  I'm just
guessing, but I think this means the icall_bb basic block has no edge to an
exception handler.  The code is expecting such an edge to exist so that it can
be used by the direct call as well.

Any suggestions on how to determine why the icall_bb has no exception handler
successor?  It also could throw, so it seems reasonable to expect that it would
have an edge to an exception handler.


Breakpoint 5, gimple_ic (icall_stmt=0x2aaaaf56f7b8, direct_call=0x2aaaaf4bcb90,
prob=10000, count=1, all=1) at ../../gcc-4.8.2/gcc/value-prof.c:1280
1280          add_stmt_to_eh_lp (dcall_stmt, lp_nr);
(gdb) n
1281          FOR_EACH_EDGE (e_eh, ei, icall_bb->succs)
(gdb) call debug_gimple_stmt(dcall_stmt)
std::_Function_base::_Base_manager<main(int, char**)::__lambda0>::_M_manager
(_5, _4, 3);

(gdb) p *icall_bb->succs
$4 = {
  vecpfx_ = {
    alloc_ = 4,
    num_ = 1
  },
  vecdata_ = {0x2aaaaf588380}
}
(gdb) n
1282            if (e_eh->flags & EDGE_EH)
(gdb) p e_eh->flags
$5 = 1
(gdb) n
1281          FOR_EACH_EDGE (e_eh, ei, icall_bb->succs)
(gdb) n
1284          e = make_edge (dcall_bb, e_eh->dest, EDGE_EH);
(gdb) p e_eh
$6 = (edge) 0x0
(gdb) p stmt_could_throw_p(dcall_stmt)
$7 = true
(gdb) p stmt_could_throw_p(icall_stmt)
$8 = true
(gdb)

Reply via email to