This is the mail archive of the gcc-patches@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]

[patch committed] Fix PR target/37909


Hi,

I've committed the attached patch to fix PR target/37909

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

which is formally a 4.2/4.3/4.4 regression.  sh.c:untangle_mova
takes INSN_ADDRESSES of which has no insn address yet.  The detail
description of the problem is in the above URL.  It might be
latent problem in the previous compilers, but I wasn't able to
make a test case failing with them.  I think that the patch would
be safe and enough for this rather rare failure.
The patch is tested with bootstrap and the top level "make -k check"
on sh4-unknown-linux-gnu with no new failures.  I'll backport
the patch to branches when the usual tests are done successfully.

Regards,
	kaz
--
2008-10-29  Kaz Kojima  <kkojima@gcc.gnu.org>

	PR target/37909
	* config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has
	no address.

--- ORIG/trunk/gcc/config/sh/sh.c	2008-10-22 09:11:15.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.c	2008-10-26 10:36:59.000000000 +0900
@@ -3826,6 +3826,10 @@ untangle_mova (int *num_mova, rtx *first
 
   if (optimize)
     {
+      /* If NEW_MOVA has no address yet, it will be handled later.  */
+      if (INSN_ADDRESSES_SIZE() <= (unsigned) INSN_UID (new_mova))
+	return -1;
+
       n_addr = INSN_ADDRESSES (INSN_UID (new_mova));
       n_target = INSN_ADDRESSES (INSN_UID (XEXP (MOVA_LABELREF (new_mova), 0)));
       if (n_addr > n_target || n_addr + 1022 < n_target)


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