------- Comment #4 from jakub at gcc dot gnu dot org 2010-05-18 13:04 ------- I guess this is related to the EH rewrite in 4.5. In particular, when building cfg for f2 in make_blocks on (gdb) p debug_gimple_stmt (stmt) S::f3 (this, D.2140); (gdb) p stmt_can_throw_internal (stmt) $47 = 0 '\000' (gdb) p stmt_could_throw_p (stmt) $48 = 1 '\001'
(apparently cfun->eh->throw_stmt_table is NULL). This means a new bb isn't created right after the call and so j = 0; stmt can be after it. Later on this j = 0; is replaced with DEBUG j => j_* and for -g0 case with nothing. The only two calls for which add_stmt_to_eh_lp_fn is called before inlining are S::f2 (nc_1(D), &D.2136); and S::~S (&D.2136); in f, no stmts in f2 nor f3. During inlining of f2 into f copy_bb -> maybe_duplicate_eh_stmt_fn -> add_stmt_to_eh_lp_fn is called on S::f3 (nc_1(D), D.2158_8); and from that point the f3 call is considered stmt_can_throw_internal. As with -g the f3 call is followed by a DEBUG stmt (which is invalid after it started to be a throwing insn), that bb is split during copy_edges_for_bb, but the -g0 f3 call was the last, so no splitting happens. I wonder whether it is correct that stmt_can_throw_internal changes on a call during inlining. If it is always false or always true, then either no DEBUG stmts would appear after it or no splitting would happen after the call during inlining. If it is intended that stmt_can_throw_internal changes during inlining, then guess copy_edges_for_bb 1901 if (!gsi_end_p (si)) 1902 /* Note that bb's predecessor edges aren't necessarily 1903 right at this point; split_block doesn't care. */ would need to skip over is_gimple_debug stmts for the test and if there are any, drop them (or something else, Alex?). -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44182