diff mbox series

[COMMITTED,GCC8] Backport PR85711

Message ID VI1PR0801MB2127A0E7CF99E16A4BD44E8183CF0@VI1PR0801MB2127.eurprd08.prod.outlook.com
State New
Headers show
Series [COMMITTED,GCC8] Backport PR85711 | expand

Commit Message

Wilco Dijkstra July 15, 2019, 11:04 a.m. UTC
Backport PR85711 to GCC8 to fix failing testcases.
AArch64 bootstrap & regtest OK.


2019-01-23  Bin Cheng  <bin.cheng@arm.com>
 	    Steve Ellcey <sellcey@marvell.com>

	PR target/85711
 	* recog.c (address_operand): Return false on wrong mode for address.
 	(constrain_operands): Check for mode with 'p' constraint.
--
diff mbox series

Patch

diff --git a/gcc/recog.c b/gcc/recog.c
index 0a8fa2ce46cf617a2372e7996e2492d1589a3ded..28dbd09e615c19a43284d7c1414457bbbf04a3db 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1070,6 +1070,11 @@  general_operand (rtx op, machine_mode mode)
 int
 address_operand (rtx op, machine_mode mode)
 {
+  /* Wrong mode for an address expr.  */
+  if (GET_MODE (op) != VOIDmode
+      && ! SCALAR_INT_MODE_P (GET_MODE (op)))
+    return false;
+
   return memory_address_p (mode, op);
 }
 
@@ -2695,10 +2700,13 @@  constrain_operands (int strict, alternative_mask alternatives)
 		/* p is used for address_operands.  When we are called by
 		   gen_reload, no one will have checked that the address is
 		   strictly valid, i.e., that all pseudos requiring hard regs
-		   have gotten them.  */
-		if (strict <= 0
-		    || (strict_memory_address_p (recog_data.operand_mode[opno],
-						 op)))
+		   have gotten them.  We also want to make sure we have a
+		   valid mode.  */
+		if ((GET_MODE (op) == VOIDmode
+		     || SCALAR_INT_MODE_P (GET_MODE (op)))
+		    && (strict <= 0
+			|| (strict_memory_address_p
+			     (recog_data.operand_mode[opno], op))))
 		  win = 1;
 		break;