When an unconditional jump with side effects targets an immediately
following label, rtl_tidy_fallthru_edge is called.  Since it has side
effects, it doesn't remove the jump, but the label is still marked
as fallthru.  This later causes a verification error.  Do nothing in this
case instead.

gcc/ChangeLog:

        * cfgrtl.c (rtl_tidy_fallthru_edge): Bail for unconditional jumps
        with side effects.
---
 gcc/ChangeLog | 5 +++++
 gcc/cfgrtl.c  | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 56e31f6..4c7046f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2016-01-02  Marcin Kościelnicki  <koria...@0x04.net>
 
+       * cfgrtl.c (rtl_tidy_fallthru_edge): Bail for unconditional jumps
+       with side effects.
+
+2016-01-02  Marcin Kościelnicki  <koria...@0x04.net>
+
        * function.c (reposition_prologue_and_epilogue_notes): Avoid
        verification error if the last insn of prologue is an unconditional
        jump.
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index fbfc7cd..dc4c2b1 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1762,6 +1762,8 @@ rtl_tidy_fallthru_edge (edge e)
      If block B consisted only of this single jump, turn it into a deleted
      note.  */
   q = BB_END (b);
+  if (JUMP_P (q) && !onlyjump_p (q))
+    return;
   if (JUMP_P (q)
       && onlyjump_p (q)
       && (any_uncondjump_p (q)
-- 
2.6.4

Reply via email to