This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/9365] [3.3 regression] [SH] segfault in gen_far_branch (config/sh/sh.c)


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|sparc-sun-solaris2.8        |
   GCC host triplet|sparc-sun-solaris2.8        |


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-09-07 15:53 -------
Confirmed on i586-redhat-linux-gnu as of gcc version 3.3.2 20030904
(prerelease). Here is a dumb patch that makes the segfault go away, but I can't
judge if the assembly code is valid.


Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.188.2.6
diff -u -p -r1.188.2.6 sh.c
--- config/sh/sh.c      25 Jun 2003 17:38:01 -0000      1.188.2.6
+++ config/sh/sh.c      7 Sep 2003 15:48:28 -0000
@@ -3233,13 +3233,16 @@ gen_far_branch (bp)
   JUMP_LABEL (jump) = bp->far_label;
   if (! invert_jump (insn, label, 1))
     abort ();
-  (emit_insn_after
-   (gen_stuff_delay_slot
-    (GEN_INT (INSN_UID (XEXP (SET_SRC (PATTERN (jump)), 0))),
-     GEN_INT (recog_memoized (insn) == CODE_FOR_branch_false)),
-    insn));
-  /* Prevent reorg from undoing our splits.  */
-  gen_block_redirect (jump, bp->address += 2, 2);
+  if (bp->far_label)
+    {
+      emit_insn_after (
+       gen_stuff_delay_slot (
+         GEN_INT (INSN_UID (XEXP (SET_SRC (PATTERN (jump)), 0))),
+         GEN_INT (recog_memoized (insn) == CODE_FOR_branch_false)),
+       insn);
+      /* Prevent reorg from undoing our splits.  */
+      gen_block_redirect (jump, bp->address += 2, 2);
+    }
 }

 /* Fix up ADDR_DIFF_VECs.  */


I removed the 'host' field because the bug is not SPARC-specific.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]