From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15904 invoked by alias); 21 Nov 2007 22:43:52 -0000 Received: (qmail 15295 invoked by uid 48); 21 Nov 2007 22:43:38 -0000 Date: Wed, 21 Nov 2007 22:43:00 -0000 Message-ID: <20071121224338.15294.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "spark at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg02029.txt.bz2 ------- Comment #15 from spark at gcc dot gnu dot org 2007-11-21 22:43 ------- (In reply to comment #14) > The patch is semi-wrong. The call to emit_insn_after_noloc() should already > set the proper BLOCK_FOR_INSN for every insn. Only doing the > df_insn_change_bb() should be sufficient. Thanks Steven. Something like: diff -r fad6feb87420 gcc/cfgrtl.c --- a/gcc/cfgrtl.c Wed Nov 21 00:17:50 2007 +0000 +++ b/gcc/cfgrtl.c Wed Nov 21 14:40:43 2007 -0800 @@ -2629,6 +2629,7 @@ cfg_layout_merge_blocks (basic_block a, /* In the case basic blocks are not adjacent, move them around. */ if (NEXT_INSN (BB_END (a)) != BB_HEAD (b)) { + rtx insn; rtx first = unlink_insn_chain (BB_HEAD (b), BB_END (b)); emit_insn_after_noloc (first, BB_END (a), a); @@ -2637,6 +2638,14 @@ cfg_layout_merge_blocks (basic_block a, first = NEXT_INSN (first); gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first)); BB_HEAD (b) = NULL; + + /* emit_insn_after_noloc doesn't call df_insn_change_bb. + We need to explicitly call df_insn_change_bb here. */ + for (insn = NEXT_INSN (first); + insn != NEXT_INSN (BB_END (b)); + insn = NEXT_INSN (insn)) + df_insn_change_bb (insn); + delete_insn (first); } /* Otherwise just re-associate the instructions. */ I see bunch of similar loops throughout cfgrtl.c. I'll see if I should refactor those loops into separate functions (one with set_block_for_insn and one without). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171