re PR target/85711 (ICE in aarch64_classify_address, at config/aarch64/aarch64.c...
authorBin Cheng <bin.cheng@arm.com>
Wed, 23 Jan 2019 22:43:42 +0000 (22:43 +0000)
committerSteve Ellcey <sje@gcc.gnu.org>
Wed, 23 Jan 2019 22:43:42 +0000 (22:43 +0000)
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.

Co-Authored-By: Steve Ellcey <sellcey@marvell.com>
From-SVN: r268219

gcc/ChangeLog
gcc/recog.c

index 5befc93d0ef91244f9b026ea6774184148ef9372..094bee4622971842ed46a494a1f2a305fc00b64c 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2019-01-23  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/88998
index d0c498fced2834205306a8d2bea807fd3786c3cc..a9f584bc0dc54e8eaea4b2211e59915fd0023da7 100644 (file)
@@ -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);
 }
 
@@ -2696,10 +2701,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;