public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/36690] [4.3/4.4 Regression] .debug_line first line is behind the first instruction
Date: Wed, 02 Jul 2008 09:23:00 -0000	[thread overview]
Message-ID: <20080702092214.3318.qmail@sourceware.org> (raw)
In-Reply-To: <bug-36690-12292@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2008-07-02  9:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 15:35 [Bug debug/36690] New: " jan dot kratochvil at redhat dot com
2008-07-01 15:53 ` [Bug debug/36690] [4.3/4.4 Regression] " jsm28 at gcc dot gnu dot org
2008-07-02  9:23 ` jakub at gcc dot gnu dot org [this message]
2008-07-10 12:02 ` jakub at gcc dot gnu dot org
2008-07-10 13:44 ` hubicka at ucw dot cz
2008-07-10 14:28 ` rguenth at gcc dot gnu dot org
2008-08-27 22:13 ` jsm28 at gcc dot gnu dot org
2008-10-03  8:56 ` jakub at gcc dot gnu dot org
2008-10-07 18:51 ` jakub at gcc dot gnu dot org
2008-10-07 19:02 ` jakub at gcc dot gnu dot org
2008-10-10  7:29 ` cnstar9988 at gmail dot com
2008-11-21 23:49 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080702092214.3318.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).