From fb2cb35283105b95b3c53d4b3ea2de69811c7d93 Mon Sep 17 00:00:00 2001
From: Kedar Sovani <kedars@marvell.com>
Date: Mon, 29 Dec 2008 15:12:03 -0500
Subject: [PATCH] Fix bug 37436

This affects the texlive package build.

Signed-off-by: Kedar Sovani <kedars@marvell.com>
---
 gcc43-pr37436.patch |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gcc43.spec          |    4 ++-
 2 files changed, 74 insertions(+), 1 deletions(-)
 create mode 100644 gcc43-pr37436.patch

diff --git a/gcc43-pr37436.patch b/gcc43-pr37436.patch
new file mode 100644
index 0000000..89b1699
--- /dev/null
+++ b/gcc43-pr37436.patch
@@ -0,0 +1,71 @@
+--- trunk/gcc/config/arm/arm.c	2008/12/16 01:28:46	142777
++++ trunk/gcc/config/arm/arm.c	2008/12/16 12:03:41	142778
+@@ -3844,6 +3844,7 @@
+       rtx xop1 = XEXP (x, 1);
+ 
+       return ((arm_address_register_rtx_p (xop0, strict_p)
++	       && GET_CODE(xop1) == CONST_INT
+ 	       && arm_legitimate_index_p (mode, xop1, outer, strict_p))
+ 	      || (arm_address_register_rtx_p (xop1, strict_p)
+ 		  && arm_legitimate_index_p (mode, xop0, outer, strict_p)));
+--- trunk/gcc/config/arm/arm.md	2008/12/16 01:28:46	142777
++++ trunk/gcc/config/arm/arm.md	2008/12/16 12:03:41	142778
+@@ -4299,7 +4299,7 @@
+ 
+ (define_expand "extendqihi2"
+   [(set (match_dup 2)
+-	(ashift:SI (match_operand:QI 1 "general_operand" "")
++	(ashift:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "")
+ 		   (const_int 24)))
+    (set (match_operand:HI 0 "s_register_operand" "")
+ 	(ashiftrt:SI (match_dup 2)
+@@ -4324,7 +4324,7 @@
+ 
+ (define_insn "*arm_extendqihi_insn"
+   [(set (match_operand:HI 0 "s_register_operand" "=r")
+-	(sign_extend:HI (match_operand:QI 1 "memory_operand" "Uq")))]
++	(sign_extend:HI (match_operand:QI 1 "arm_extendqisi_mem_op" "Uq")))]
+   "TARGET_ARM && arm_arch4"
+   "ldr%(sb%)\\t%0, %1"
+   [(set_attr "type" "load_byte")
+@@ -4335,7 +4335,7 @@
+ 
+ (define_expand "extendqisi2"
+   [(set (match_dup 2)
+-	(ashift:SI (match_operand:QI 1 "general_operand" "")
++	(ashift:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "")
+ 		   (const_int 24)))
+    (set (match_operand:SI 0 "s_register_operand" "")
+ 	(ashiftrt:SI (match_dup 2)
+@@ -4367,7 +4367,7 @@
+ 
+ (define_insn "*arm_extendqisi"
+   [(set (match_operand:SI 0 "s_register_operand" "=r")
+-	(sign_extend:SI (match_operand:QI 1 "memory_operand" "Uq")))]
++	(sign_extend:SI (match_operand:QI 1 "arm_extendqisi_mem_op" "Uq")))]
+   "TARGET_ARM && arm_arch4 && !arm_arch6"
+   "ldr%(sb%)\\t%0, %1"
+   [(set_attr "type" "load_byte")
+@@ -4378,7 +4378,8 @@
+ 
+ (define_insn "*arm_extendqisi_v6"
+   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
+-	(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Uq")))]
++	(sign_extend:SI
++	 (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "r,Uq")))]
+   "TARGET_ARM && arm_arch6"
+   "@
+    sxtb%?\\t%0, %1
+--- trunk/gcc/config/arm/predicates.md	2008/12/16 01:28:46	142777
++++ trunk/gcc/config/arm/predicates.md	2008/12/16 12:03:41	142778
+@@ -234,6 +234,10 @@
+        (match_test "arm_legitimate_address_p (mode, XEXP (op, 0), SIGN_EXTEND,
+ 					      0)")))
+ 
++(define_special_predicate "arm_reg_or_extendqisi_mem_op"
++  (ior (match_operand 0 "arm_extendqisi_mem_op")
++       (match_operand 0 "s_register_operand")))
++
+ (define_predicate "power_of_two_operand"
+   (match_code "const_int")
+ {
diff --git a/gcc43.spec b/gcc43.spec
index bbf00e1..3b1dc93 100644
--- a/gcc43.spec
+++ b/gcc43.spec
@@ -42,7 +42,7 @@
 Summary: Various compilers (C, C++, Objective-C, Java, ...)
 Name: gcc
 Version: %{gcc_version}
-Release: %{gcc_release}.fa3
+Release: %{gcc_release}.fa4
 # libgcc, libgfortran, libmudflap and crtstuff have an exception which allows
 # linking it into any kind of programs or shared libraries without
 # restrictions.
@@ -176,6 +176,7 @@ Patch31: gcc43-pr37924.patch
 Patch32: gcc43-arm-progbits.patch
 Patch33: libgcc_post_upgrade.c.arm.patch
 Patch34: gcc43-pr35965.patch
+Patch35: gcc43-pr37436.patch
 # On ARM EABI systems, we do want -gnueabi to be part of the
 # target triple.
 %ifnarch %{arm}
@@ -492,6 +493,7 @@ which are required to run programs compiled with the GNAT.
 %patch31 -p0 -b .pr37924~
 %patch32 -p1 -b .progbits~
 %patch34 -p1 -b .pr35965~
+%patch35 -p1 -b .pr37436~
 
 tar xzf %{SOURCE4}
 
-- 
1.5.3.3

