public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot
@ 2011-07-09  6:03 kkojima at gcc dot gnu.org
  2011-07-09 15:19 ` [Bug rtl-optimization/49686] " hp at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-07-09  6:03 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.7 Regression] CFI notes are missed for delayed slot
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: EH
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kkojima@gcc.gnu.org
                CC: rth@gcc.gnu.org
            Target: sh4-unknown-linux-gnu


Many EH tests fail on SH after the recent dwarf2 clean up.  These
failures went away with -fno-delayed-branch.  A tiny testcase is

int foo (int a)
{
  if (a)
    bar ();
  return 1;
}

and with -O1 -fexceptions -fnon-call-exceptions, its assember
output of the new compiler starts like

foo:
.LFB0:
    tst    r4,r4
    bt/s    .L2
    sts.l    pr,@-r15

while the old compiler outputs CFI for the last frame related
insn sts.l pr,@-r15 in the delayed slot:

foo:
.LFB0:
    tst    r4,r4
.LCFI0:
    bt/s    .L2
    sts.l    pr,@-r15

It seems that dwarf2out_frame_debug emits CFI notes at the middle
of the elements of SEQUENCE and they were lost.  The patch below
works for me.

--- ORIG/trunk/gcc/dwarf2cfi.c    2011-07-09 14:42:50.000000000 +0900
+++ trunk/gcc/dwarf2cfi.c    2011-07-09 14:46:18.000000000 +0900
@@ -2170,11 +2170,10 @@ dwarf2out_frame_debug_expr (rtx expr)
    sets SP or FP (adjusting how we calculate the frame address) or saves a
    register to the stack.  If INSN is NULL_RTX, initialize our state.

-   If AFTER_P is false, we're being called before the insn is emitted,
-   otherwise after.  Call instructions get invoked twice.  */
+   Notes are inserted at WHERE.  Call instructions get invoked twice.  */

 static void
-dwarf2out_frame_debug (rtx insn, bool after_p)
+dwarf2out_frame_debug (rtx insn, rtx where)
 {
   rtx note, n;
   bool handled_one = false;
@@ -2183,13 +2182,13 @@ dwarf2out_frame_debug (rtx insn, bool af
   /* Remember where we are to insert notes.  Do not separate tablejump
      insns from their ADDR_DIFF_VEC.  Putting the note after the VEC
      should be ok.  */
-  if (after_p)
+  if (insn == where)
     {
       if (!tablejump_p (insn, NULL, &cfi_insn))
-    cfi_insn = insn;
+    cfi_insn = where;
     }
   else
-    cfi_insn = PREV_INSN (insn);
+    cfi_insn = where;

   if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn))
     dwarf2out_flush_queued_reg_saves ();
@@ -2200,7 +2199,7 @@ dwarf2out_frame_debug (rtx insn, bool af
      matter if the stack pointer is not the CFA register anymore but
      is still used to save registers.  */
       if (!ACCUMULATE_OUTGOING_ARGS)
-    dwarf2out_notice_stack_adjust (insn, after_p);
+    dwarf2out_notice_stack_adjust (insn, (insn == where));
       cfi_insn = NULL;
       return;
     }
@@ -2434,7 +2433,7 @@ create_cfi_notes (void)

       if (BARRIER_P (insn))
     {
-      dwarf2out_frame_debug (insn, false);
+      dwarf2out_frame_debug (insn, PREV_INSN (insn));
       continue;
         }

@@ -2469,7 +2468,7 @@ create_cfi_notes (void)
       pat = PATTERN (insn);
       if (asm_noperands (pat) >= 0)
     {
-      dwarf2out_frame_debug (insn, false);
+      dwarf2out_frame_debug (insn, PREV_INSN (insn));
       continue;
     }

@@ -2477,14 +2476,14 @@ create_cfi_notes (void)
     {
       int i, n = XVECLEN (pat, 0);
       for (i = 1; i < n; ++i)
-        dwarf2out_frame_debug (XVECEXP (pat, 0, i), false);
+        dwarf2out_frame_debug (XVECEXP (pat, 0, i), PREV_INSN (insn));
     }

       if (CALL_P (insn)
       || find_reg_note (insn, REG_CFA_FLUSH_QUEUE, NULL))
-    dwarf2out_frame_debug (insn, false);
+    dwarf2out_frame_debug (insn, PREV_INSN (insn));

-      dwarf2out_frame_debug (insn, true);
+      dwarf2out_frame_debug (insn, insn);
     }
 }


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
@ 2011-07-09 15:19 ` hp at gcc dot gnu.org
  2011-07-09 16:14 ` rth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hp at gcc dot gnu.org @ 2011-07-09 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hp at gcc dot gnu.org

--- Comment #1 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2011-07-09 15:18:42 UTC ---
(In reply to comment #0)
> Many EH tests fail on SH after the recent dwarf2 clean up.

Does the regression look something like this?

--- regress.prev        2011-07-09 06:44:48.000000000 +0200
+++ regress     2011-07-09 09:45:51.000000000 +0200
@@ -1,2 +1,17 @@
+g++.sum g++.dg/torture/pr49115.C
 gcc.sum gcc.dg/tls/alias-1.c
 gcc.sum gcc.dg/uninit-pred-8_b.c
+libstdc++.sum 21_strings/basic_string/cons/char/1.cc
+libstdc++.sum 21_strings/basic_string/cons/char/3.cc
+libstdc++.sum 21_strings/basic_string/cons/wchar_t/1.cc
+libstdc++.sum 23_containers/deque/requirements/exception/basic.cc
+libstdc++.sum 23_containers/forward_list/requirements/exception/basic.cc
+libstdc++.sum
23_containers/forward_list/requirements/exception/propagation_consistent.cc
+libstdc++.sum 23_containers/list/operations/5.cc
+libstdc++.sum 23_containers/list/requirements/exception/basic.cc
+libstdc++.sum
23_containers/list/requirements/exception/propagation_consistent.cc
+libstdc++.sum 23_containers/vector/cons/4.cc
+libstdc++.sum 27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc
+libstdc++.sum 27_io/basic_ostream/seekp/wchar_t/exceptions_badbit_throw.cc
+libstdc++.sum 27_io/ios_base/storage/2.cc
+libstdc++.sum ext/pb_ds/example/hash_illegal_resize.cc

(For cris-elf)


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
  2011-07-09 15:19 ` [Bug rtl-optimization/49686] " hp at gcc dot gnu.org
@ 2011-07-09 16:14 ` rth at gcc dot gnu.org
  2011-07-09 19:58 ` rth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu.org @ 2011-07-09 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Henderson <rth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.07.09 16:13:18
         AssignedTo|unassigned at gcc dot       |rth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Henderson <rth at gcc dot gnu.org> 2011-07-09 16:13:18 UTC ---
Mine.  Thanks for the patch.  I think I'll clean this up
a different way though.


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
  2011-07-09 15:19 ` [Bug rtl-optimization/49686] " hp at gcc dot gnu.org
  2011-07-09 16:14 ` rth at gcc dot gnu.org
@ 2011-07-09 19:58 ` rth at gcc dot gnu.org
  2011-07-09 20:59 ` rth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu.org @ 2011-07-09 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Henderson <rth at gcc dot gnu.org> 2011-07-09 19:57:30 UTC ---
Author: rth
Date: Sat Jul  9 19:57:27 2011
New Revision: 176091

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176091
Log:
PR debug/49686
    * dwarf2cfi.c (dwarf2out_frame_debug): Don't set cfi_insn here...
    (create_cfi_notes): ... do it here instead.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2cfi.c


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-07-09 19:58 ` rth at gcc dot gnu.org
@ 2011-07-09 20:59 ` rth at gcc dot gnu.org
  2011-07-09 21:14 ` kkojima at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu.org @ 2011-07-09 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Henderson <rth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Richard Henderson <rth at gcc dot gnu.org> 2011-07-09 20:59:00 UTC ---
Fixed.


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-07-09 20:59 ` rth at gcc dot gnu.org
@ 2011-07-09 21:14 ` kkojima at gcc dot gnu.org
  2011-07-11  9:28 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-07-09 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-07-09 21:13:52 UTC ---
Thanks for the quick fix!

(In reply to comment #1)
> Does the regression look something like this?

For sh, the failures were

FAIL: g++.dg/compat/eh/unexpected1 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: g++.dg/cpp0x/lambda/lambda-eh2.C execution test
FAIL: g++.dg/eh/crossjump1.C execution test
FAIL: g++.dg/eh/unexpected1.C execution test
FAIL: g++.dg/ext/cleanup-10.C execution test
FAIL: g++.dg/ext/cleanup-11.C execution test
FAIL: g++.dg/torture/pr49115.C  -O1  execution test
...

FAIL: 18_support/exception_ptr/lifespan.cc execution test
FAIL: 18_support/nested_exception/rethrow_if_nested.cc execution test
FAIL: 18_support/nested_exception/throw_with_nested.cc execution test
FAIL: 20_util/function/1.cc execution test
FAIL: 20_util/hash/chi2_quality.cc execution test
FAIL: 20_util/hash/quality.cc execution test
FAIL: 21_strings/basic_string/append/char/1.cc execution test
FAIL: 21_strings/basic_string/append/wchar_t/1.cc execution test
FAIL: 21_strings/basic_string/cons/char/1.cc execution test
FAIL: 21_strings/basic_string/cons/char/3.cc execution test
...


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-07-09 21:14 ` kkojima at gcc dot gnu.org
@ 2011-07-11  9:28 ` rguenth at gcc dot gnu.org
  2011-08-04 12:18 ` kkojima at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-11  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-07-11  9:28 ` rguenth at gcc dot gnu.org
@ 2011-08-04 12:18 ` kkojima at gcc dot gnu.org
  2011-08-04 13:31 ` hp at gcc dot gnu.org
  2011-08-04 13:57 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-08-04 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-08-04 12:18:09 UTC ---
It seems that the problem comes back on trunk revision 177305
for SH.  There are many EH test failures which went away with
-fno-delayed-branch and the testcase in #1 is assembled to

foo:
.LFB0:
    tst    r4,r4
    bt/s    .L2
    sts.l    pr,@-r15
    mov.l    .L3,r0
    jsr    @r0
    nop

with -O1 -fexceptions -fnon-call-exceptions.


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-08-04 12:18 ` kkojima at gcc dot gnu.org
@ 2011-08-04 13:31 ` hp at gcc dot gnu.org
  2011-08-04 13:57 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hp at gcc dot gnu.org @ 2011-08-04 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2011-08-04 13:30:48 UTC ---
(In reply to comment #6)
> It seems that the problem comes back on trunk revision 177305
> for SH.

At a glance that may have happened for cris-elf too, worked r177217,
(additional) regressions observed r177225, still there r177330:
g++.sum g++.dg/torture/pr49115.C
libstdc++.sum 23_containers/unordered_map/requirements/exception/basic.cc
libstdc++.sum 23_containers/unordered_multimap/requirements/exception/basic.cc
libstdc++.sum 27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc
libstdc++.sum 27_io/basic_ostream/seekp/wchar_t/exceptions_badbit_throw.cc

Maybe open a new PR?


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

* [Bug rtl-optimization/49686] [4.7 Regression] CFI notes are missed for delayed slot
  2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-08-04 13:31 ` hp at gcc dot gnu.org
@ 2011-08-04 13:57 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-08-04 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-08-04 13:57:14 UTC ---
Thanks for checking cris-elf.  I'd like to open a new PR.


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

end of thread, other threads:[~2011-08-04 13:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09  6:03 [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot kkojima at gcc dot gnu.org
2011-07-09 15:19 ` [Bug rtl-optimization/49686] " hp at gcc dot gnu.org
2011-07-09 16:14 ` rth at gcc dot gnu.org
2011-07-09 19:58 ` rth at gcc dot gnu.org
2011-07-09 20:59 ` rth at gcc dot gnu.org
2011-07-09 21:14 ` kkojima at gcc dot gnu.org
2011-07-11  9:28 ` rguenth at gcc dot gnu.org
2011-08-04 12:18 ` kkojima at gcc dot gnu.org
2011-08-04 13:31 ` hp at gcc dot gnu.org
2011-08-04 13:57 ` kkojima 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).