From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3611 invoked by alias); 2 Jul 2008 09:23:08 -0000 Received: (qmail 3319 invoked by uid 48); 2 Jul 2008 09:22:14 -0000 Date: Wed, 02 Jul 2008 09:23:00 -0000 Message-ID: <20080702092214.3318.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug debug/36690] [4.3/4.4 Regression] .debug_line first line is behind the first instruction In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub 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: 2008-07/txt/msg00086.txt.bz2 ------- Comment #2 from jakub at gcc dot gnu dot org 2008-07-02 09:22 ------- This is caused by the implicit gotos at the end of basic blocks. See http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01840.html During cfgexpand this can be IMHO fixed by setting curr_location before emitting the jump, not after it (otherwise e->goto_locus is IMHO useless, as most likely the following statements will change curr_location before anything is emitted): --- gcc/cfgexpand.c.jj 2008-06-06 09:17:07.000000000 +0200 +++ gcc/cfgexpand.c 2008-07-02 10:43:54.000000000 +0200 @@ -1610,9 +1610,9 @@ expand_gimple_basic_block (basic_block b if (e && e->dest != bb->next_bb) { - emit_jump (label_rtx_for_bb (e->dest)); if (e->goto_locus) set_curr_insn_source_location (e->goto_locus); + emit_jump (label_rtx_for_bb (e->dest)); e->flags &= ~EDGE_FALLTHRU; } Not sure if expand_gimple_cond_expr should stay as is or be modified as well. This fixes this problem for the few early RTL passes, but then we go into cfglayout mode and the JUMP is removed again. force_nonfallthru_and_redirect then when going out of cfglayout mode recreates the JUMP again, but completely ignores e->goto_locus: if (target == EXIT_BLOCK_PTR) { #ifdef HAVE_return emit_jump_insn_after_noloc (gen_return (), BB_END (jump_block)); #else gcc_unreachable (); #endif } else { rtx label = block_label (target); emit_jump_insn_after_noloc (gen_jump (label), BB_END (jump_block)); JUMP_LABEL (BB_END (jump_block)) = label; LABEL_NUSES (label)++; } One problem is that we have just locus for the edges, not BLOCK, so if force_nonfallthru_and_redirect were to call emit_jump_insn_after_setloc instead, the question is what BLOCK should be used for it (e.g. pick the block from insn before the jump (if any)? What to do if there is none in the basic block?). -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rakdver at gcc dot gnu dot | |org, hubicka at gcc dot gnu | |dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36690