* recog.c (constrain_operands): Validate mem operands.
authorRichard Henderson <rth@redhat.com>
Sat, 10 Jan 2004 03:14:07 +0000 (19:14 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 10 Jan 2004 03:14:07 +0000 (19:14 -0800)
From-SVN: r75624

gcc/ChangeLog
gcc/recog.c

index 06768ae..64dcf07 100644 (file)
@@ -1,3 +1,7 @@
+2004-01-09  Richard Henderson  <rth@redhat.com>
+
+       * recog.c (constrain_operands): Validate mem operands.
+
 2004-01-09   James E Wilson  <wilson@specifixinc.com>
 
        * gcc.c (init_spec): Remove -lunwind from shared case.
index 9f5c152..d2338e6 100644 (file)
@@ -2445,12 +2445,25 @@ constrain_operands (int strict)
                break;
 
              case 'm':
-               if (GET_CODE (op) == MEM
-                   /* Before reload, accept what reload can turn into mem.  */
-                   || (strict < 0 && CONSTANT_P (op))
-                   /* During reload, accept a pseudo  */
-                   || (reload_in_progress && GET_CODE (op) == REG
-                       && REGNO (op) >= FIRST_PSEUDO_REGISTER))
+               /* Memory operands must be valid, to the extent
+                  required by STRICT.  */
+               if (GET_CODE (op) == MEM)
+                 {
+                   if (strict > 0
+                       && !strict_memory_address_p (GET_MODE (op),
+                                                    XEXP (op, 0)))
+                     break;
+                   if (strict == 0
+                       && !memory_address_p (GET_MODE (op), XEXP (op, 0)))
+                     break;
+                   win = 1;
+                 }
+               /* Before reload, accept what reload can turn into mem.  */
+               else if (strict < 0 && CONSTANT_P (op))
+                 win = 1;
+               /* During reload, accept a pseudo  */
+               else if (reload_in_progress && GET_CODE (op) == REG
+                        && REGNO (op) >= FIRST_PSEUDO_REGISTER)
                  win = 1;
                break;