public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/56131] [4.8 regression] gcc.dg/pr56035.c ICEs gcc on sparc-linux
Date: Fri, 22 Feb 2013 10:30:00 -0000	[thread overview]
Message-ID: <bug-56131-4-cxxBn3YoVc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56131-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56131

--- Comment #14 from vries at gcc dot gnu.org 2013-02-22 10:30:06 UTC ---
Steven,

thanks for the comments.

> Nothing even trying to look at the CFG after freeing it, so the looks at
> BLOCK_FOR_INSN in delete_insn are non-sense.

AFAIU now from
http://gcc.gnu.org/onlinedocs/gccint/Maintaining-the-CFG.html#Maintaining-the-CFG,
BLOCK_FOR_INSN == NULL shows whether the CFG has been freed or not, so I'd say
it makes sense to test for equality of BLOCK_FOR_INSN when non-NULL.

> Looking for the basic block
> anywhere at all at this point makes no sense,

If I understand you correctly with 'this point' you mean 'after the CFG has
been freed'?

> basic block contents and
> boundaries are not maintained and may be scrambled enough to make even
> the basic block notes unreliable.

OK. I've added a comment in insn-notes.def in the patch below to make that more
explicit.

> Also, "If the label is not marked with a bb, assume it's the same bb"
> is wrong if the label is a marker for a constant pool or a jump table.

OK, fixed in patch below.

Does this patch address all your concerns?
...
Index: gcc/insn-notes.def
===================================================================
--- gcc/insn-notes.def (revision 195874)
+++ gcc/insn-notes.def (working copy)
@@ -70,7 +70,9 @@ INSN_NOTE (CALL_ARG_LOCATION)

 /* Record the struct for the following basic block.  Uses
    NOTE_BASIC_BLOCK.  FIXME: Redundant with the basic block pointer
-   now included in every insn.  */
+   now included in every insn.  NOTE: If there's no CFG anymore, in other
words,
+   if BLOCK_FOR_INSN () == NULL, NOTE_BASIC_BLOCK cannot be considered
reliable
+   anymore.  */
 INSN_NOTE (BASIC_BLOCK)

 /* Mark the inflection point in the instruction stream where we switch
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c (revision 195874)
+++ gcc/cfgrtl.c (working copy)
@@ -135,7 +135,7 @@ delete_insn (rtx insn)
       if (! can_delete_label_p (insn))
     {
       const char *name = LABEL_NAME (insn);
-      basic_block bb, label_bb = BLOCK_FOR_INSN (insn);
+      basic_block bb = BLOCK_FOR_INSN (insn);
       rtx bb_note = NEXT_INSN (insn);

       really_delete = false;
@@ -144,15 +144,13 @@ delete_insn (rtx insn)
       NOTE_DELETED_LABEL_NAME (insn) = name;

       /* If the note following the label starts a basic block, and the
-         label is a member of the same basic block, interchange the two.
-         If the label is not marked with a bb, assume it's the same bb.  */
+         label is a member of the same basic block, interchange the two.  */
       if (bb_note != NULL_RTX
           && NOTE_INSN_BASIC_BLOCK_P (bb_note)
-          && (label_bb == NOTE_BASIC_BLOCK (bb_note)
-          || label_bb == NULL))
+          && bb != NULL
+          && bb == BLOCK_FOR_INSN (bb_note))
         {
           reorder_insns_nobb (insn, insn, bb_note);
-          bb = NOTE_BASIC_BLOCK (bb_note);
           BB_HEAD (bb) = bb_note;
           if (BB_END (bb) == bb_note)
         BB_END (bb) = insn;
...


  parent reply	other threads:[~2013-02-22 10:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 17:42 [Bug regression/56131] New: " mikpe at it dot uu.se
2013-01-28 21:59 ` [Bug regression/56131] " mikpe at it dot uu.se
2013-01-28 23:16 ` vries at gcc dot gnu.org
2013-01-29  0:28 ` vries at gcc dot gnu.org
2013-01-29 10:12 ` [Bug rtl-optimization/56131] " rguenth at gcc dot gnu.org
2013-01-29 17:01 ` danglin at gcc dot gnu.org
2013-01-29 19:34 ` vries at gcc dot gnu.org
2013-01-30 22:20 ` mikpe at it dot uu.se
2013-02-04 13:08 ` ro at gcc dot gnu.org
2013-02-04 15:19 ` vries at gcc dot gnu.org
2013-02-04 15:39 ` mikpe at it dot uu.se
2013-02-04 17:35 ` vries at gcc dot gnu.org
2013-02-06  8:54 ` vries at gcc dot gnu.org
2013-02-06 12:24 ` vries at gcc dot gnu.org
2013-02-21 10:30 ` steven at gcc dot gnu.org
2013-02-22 10:30 ` vries at gcc dot gnu.org [this message]
2013-02-22 13:18 ` jakub at gcc dot gnu.org
2013-02-22 16:34 ` steven at gcc dot gnu.org
2013-02-22 22:37 ` vries at gcc dot gnu.org
2013-02-25  9:31 ` vries at gcc dot gnu.org
2013-02-25 10:34 ` jakub at gcc dot gnu.org
2013-02-25 11:50 ` vries at gcc dot gnu.org
2013-02-25 11:51 ` vries at gcc dot gnu.org
2013-02-25 19:55 ` stevenb.gcc at gmail dot com
2013-02-25 19:59 ` stevenb.gcc at gmail dot com
2013-02-25 22:29 ` ebotcazou at gcc dot gnu.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=bug-56131-4-cxxBn3YoVc@http.gcc.gnu.org/bugzilla/ \
    --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).