public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
@ 2013-04-13 23:14 steven at gcc dot gnu.org
  2013-04-13 23:15 ` [Bug debug/56950] " steven at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2013-04-13 23:14 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56950
           Summary: compare-debug failure for gcc.dg/pr41345.c with
                    fschedule-insns
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: steven@gcc.gnu.org


$ cat pr41345.c 
/* PR bootstrap/41345 */
/* { dg-do compile } */
/* { dg-options "-O2 -g -fcompare-debug" } */
/* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */

void
foo (int *x)
{
  int a;
  for (a = 0; a < 2; a++)
    if (x[a])
      goto lab;
  __builtin_unreachable ();
lab:;
}

$ ./xgcc -B. -S -O2 -g -fcompare-debug pr41345.c -fschedule-insns
xgcc: error: pr41345.c: -fcompare-debug failure (length)
$

The problem appears to be an extra NOTE_INSN_DELETED, inserted in
the sched1 pass:

@@ -42,8 +54,11 @@
 ;;  exit block uses     6 [bp] 7 [sp] 20 [frame]
 ;;  regs ever live
 ;;  ref usage  r0={1d} r1={1d} r2={1d} r4={1d} r5={1d} r6={1d,2u} r7={1d,2u}
r16={1d,1u} r20={1d,2u} r21={1d} r22={1d} r23={1d} r24={1d} r25={1d} r26={1d}
r27={1d} r28={1d} r37={1d} r38={1d}
-;;    total ref usage 26{19d,7u,0e} in 0{0 regular + 0 call} insns.
+;;    total ref usage 26{19d,7u,0e} in 1{1 regular + 0 call} insns.
 (note 1 0 4 NOTE_INSN_DELETED)
 (note 4 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
-(note 3 4 10 2 NOTE_INSN_FUNCTION_BEG)
-(note 10 3 0 ("lab") NOTE_INSN_DELETED_LABEL 2)
+(note 3 4 7 2 NOTE_INSN_FUNCTION_BEG)
+(debug_insn 7 3 18 2 (var_location:SI a (const_int 0 [0])) -1
+     (nil))
+(note 18 7 14 NOTE_INSN_DELETED)
+(note 14 18 0 ("lab") NOTE_INSN_DELETED_LABEL 2)

The note 18 comes from haifa-sched.c:sched_extend_bb.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
@ 2013-04-13 23:15 ` steven at gcc dot gnu.org
  2013-04-14 19:30 ` steven at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2013-04-13 23:15 UTC (permalink / raw)
  To: gcc-bugs


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build, wrong-debug
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-13
                 CC|                            |aoliva at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2013-04-13 23:15:07 UTC ---
Breaks bootstrap with -fschedule-insn on i686.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
  2013-04-13 23:15 ` [Bug debug/56950] " steven at gcc dot gnu.org
@ 2013-04-14 19:30 ` steven at gcc dot gnu.org
  2013-05-17 22:39 ` steven at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2013-04-14 19:30 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-04-14 19:30:38 UTC ---
(In reply to comment #2)
> I am testing this fix:

Hmm, no that is not a fix...


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
  2013-04-13 23:15 ` [Bug debug/56950] " steven at gcc dot gnu.org
  2013-04-14 19:30 ` steven at gcc dot gnu.org
@ 2013-05-17 22:39 ` steven at gcc dot gnu.org
  2013-05-20 13:16 ` steven at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2013-05-17 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com

--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> ---
*** Bug 57257 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-05-17 22:39 ` steven at gcc dot gnu.org
@ 2013-05-20 13:16 ` steven at gcc dot gnu.org
  2013-05-20 13:31 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2013-05-20 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Steven Bosscher <steven at gcc dot gnu.org> ---
This patch makes the ICE go away, but it doesn't really solve the bug.

The scheduler inserts (in this case) notes between basic blocks in the
sched1 pass, which runs in cfglayout mode.  But "between basic blocks"
in cfglayout mode means nothing: such things belong in BB_HEADER and
BB_FOOTER.

But that happens before and after this patch, so the patch merely puts
things back to the status ante quo.  So be solved properly later...

Index: haifa-sched.c
===================================================================
--- haifa-sched.c       (revision 199028)
+++ haifa-sched.c       (working copy)
@@ -7442,11 +7442,12 @@ sched_extend_bb (void)
   if (NEXT_INSN (insn) == 0
       || (!NOTE_P (insn)
          && !LABEL_P (insn)
+         && !DEBUG_INSN_P (insn)
          /* Don't emit a NOTE if it would end up before a BARRIER.  */
          && !BARRIER_P (NEXT_INSN (insn))))
     {
       rtx note = emit_note_after (NOTE_INSN_DELETED, insn);
-      /* Make insn appear outside BB.  */
+      /* Make note appear outside BB.  */
       set_block_for_insn (note, NULL);
       BB_END (EXIT_BLOCK_PTR->prev_bb) = insn;
     }


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-05-20 13:16 ` steven at gcc dot gnu.org
@ 2013-05-20 13:31 ` jakub at gcc dot gnu.org
  2013-05-20 13:44 ` stevenb.gcc at gmail dot com
  2013-05-20 14:02 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-20 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That still doesn't look safe -fcompare-debug wise.
I mean, if BB ends in a DEBUG_INSN (or more), it could be preceeded by note,
label, or some other insns.  So shouldn't that be instead
  rtx insn2 = DEBUG_INSN_P (insn) ? prev_nondebug_insn (insn2) : insn;
(I'd hope there shouldn't be DEBUG_INSN only bb's, because then with -g0 insn
ought to be NULL and NEXT_INSN (insn) should crash), and use this in the
!NOTE_P and !LABEL_P tests?  When NEXT_INSN (insn) is used, it should keep
using the BB_END insn, even if it is a DEBUG_INSN, we are looking at what comes
afterwards.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-05-20 13:31 ` jakub at gcc dot gnu.org
@ 2013-05-20 13:44 ` stevenb.gcc at gmail dot com
  2013-05-20 14:02 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: stevenb.gcc at gmail dot com @ 2013-05-20 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from stevenb.gcc at gmail dot com <stevenb.gcc at gmail dot com> ---
> --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> That still doesn't look safe -fcompare-debug wise.
> I mean, if BB ends in a DEBUG_INSN (or more), it could be preceeded by note,
> label, or some other insns.  So shouldn't that be instead
>   rtx insn2 = DEBUG_INSN_P (insn) ? prev_nondebug_insn (insn2) : insn;

I suppose so, yes.

> (I'd hope there shouldn't be DEBUG_INSN only bb's, because then with -g0 insn
> ought to be NULL and NEXT_INSN (insn) should crash), and use this in the
> !NOTE_P and !LABEL_P tests?

This block is a DEBUG_INSN-only block, but insn is never NULL: BB_END
will be the basic block note.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debug/56950] compare-debug failure for gcc.dg/pr41345.c with fschedule-insns
  2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-05-20 13:44 ` stevenb.gcc at gmail dot com
@ 2013-05-20 14:02 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-20 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Steven Bosscher from comment #7)
> Index: haifa-sched.c
> ===================================================================
> --- haifa-sched.c       (revision 199028)
> +++ haifa-sched.c       (working copy)
> @@ -7435,20 +7435,19 @@ find_fallthru_edge_from (basic_block pre
>  static void
>  sched_extend_bb (void)
>  {
> -  rtx insn;
> -
>    /* The following is done to keep current_sched_info->next_tail non null. 
> */
> -  insn = BB_END (EXIT_BLOCK_PTR->prev_bb);
> +  rtx end = BB_END (EXIT_BLOCK_PTR->prev_bb);
> +  rtx insn = DEBUG_INSN_P (end) ? prev_nondebug_insn (end) : end;
>    if (NEXT_INSN (insn) == 0

This should be NEXT_INSN (end) == 0

>        || (!NOTE_P (insn)
>           && !LABEL_P (insn)
>           /* Don't emit a NOTE if it would end up before a BARRIER.  */
>           && !BARRIER_P (NEXT_INSN (insn))))

and this && !BARRIER_P (NEXT_INSN (end))))

>      {
> -      rtx note = emit_note_after (NOTE_INSN_DELETED, insn);
> -      /* Make insn appear outside BB.  */
> +      rtx note = emit_note_after (NOTE_INSN_DELETED, end);
> +      /* Make note appear outside BB.  */
>        set_block_for_insn (note, NULL);
> -      BB_END (EXIT_BLOCK_PTR->prev_bb) = insn;
> +      BB_END (EXIT_BLOCK_PTR->prev_bb) = end;
>      }
>  }


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-20 14:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-13 23:14 [Bug debug/56950] New: compare-debug failure for gcc.dg/pr41345.c with fschedule-insns steven at gcc dot gnu.org
2013-04-13 23:15 ` [Bug debug/56950] " steven at gcc dot gnu.org
2013-04-14 19:30 ` steven at gcc dot gnu.org
2013-05-17 22:39 ` steven at gcc dot gnu.org
2013-05-20 13:16 ` steven at gcc dot gnu.org
2013-05-20 13:31 ` jakub at gcc dot gnu.org
2013-05-20 13:44 ` stevenb.gcc at gmail dot com
2013-05-20 14:02 ` jakub at gcc dot gnu.org

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