From 9f8e7a96c2d45daf5ee6e0ce9a1cbe4c80cbf96b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 2 May 2013 15:46:12 +0000 Subject: re PR middle-end/57140 (Segmentation fault in backtrace_dwarf_add) 2013-05-02 Richard Biener PR middle-end/57140 * tree-inline.c (copy_loops): Properly handle removed loops. (copy_cfg_body): Mark destination loops for fixup if source loops needed fixup. * g++.dg/torture/pr57140.C: New testcase. From-SVN: r198548 --- gcc/tree-inline.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index a650f0d..b5339c4 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2208,8 +2208,11 @@ copy_loops (bitmap blocks_to_copy, /* Assign the new loop its header and latch and associate those with the new loop. */ - dest_loop->header = (basic_block)src_loop->header->aux; - dest_loop->header->loop_father = dest_loop; + if (src_loop->header != NULL) + { + dest_loop->header = (basic_block)src_loop->header->aux; + dest_loop->header->loop_father = dest_loop; + } if (src_loop->latch != NULL) { dest_loop->latch = (basic_block)src_loop->latch->aux; @@ -2336,6 +2339,11 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale, loops_state_set (LOOPS_NEED_FIXUP); } + /* If the loop tree in the source function needed fixup, mark the + destination loop tree for fixup, too. */ + if (loops_for_fn (src_cfun)->state & LOOPS_NEED_FIXUP) + loops_state_set (LOOPS_NEED_FIXUP); + if (gimple_in_ssa_p (cfun)) FOR_ALL_BB_FN (bb, cfun_to_copy) if (!blocks_to_copy -- cgit v1.1