expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF...
authorRichard Henderson <rth@cygnus.com>
Fri, 22 May 1998 23:03:25 +0000 (16:03 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 22 May 1998 23:03:25 +0000 (16:03 -0700)
* expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF, if the
offset's mode is not ptr_mode, convert it.

From-SVN: r19965

gcc/ChangeLog
gcc/expr.c

index 4b21e905eb594565cc82328398d199be8cd0d297..1d5d766a6588081c78b067c7efa75021e1d55dd1 100644 (file)
@@ -1,3 +1,8 @@
+1998-05-23  Richard Henderson  <rth@cygnus.com>
+
+       * expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF, if the
+       offset's mode is not ptr_mode, convert it.
+
 1998-05-22  Jason Merrill  <jason@yorick.cygnus.com>
 
        * fold-const.c (ssize_binop): New fn.
index 300e55862af1a322ca4ac82d74ee89841f94c281..b8b1ab80c50911a56683f4c49a0916826b3c094f 100644 (file)
@@ -2907,6 +2907,16 @@ expand_assignment (to, from, want_value, suggest_reg)
 
          if (GET_CODE (to_rtx) != MEM)
            abort ();
+
+         if (GET_MODE (offset_rtx) != ptr_mode)
+           {
+#ifdef POINTERS_EXTEND_UNSIGNED
+             offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1);
+#else
+             offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
+#endif
+           }
+
          to_rtx = change_address (to_rtx, VOIDmode,
                                   gen_rtx_PLUS (ptr_mode, XEXP (to_rtx, 0),
                                                 force_reg (ptr_mode, offset_rtx)));
@@ -3307,7 +3317,7 @@ store_expr (exp, target, want_value)
     {
       target = protect_from_queue (target, 1);
       if (GET_MODE (temp) != GET_MODE (target)
-         && GET_MODE (temp) != VOIDmode)
+         && GET_MODE (target) != VOIDmode)
        {
          int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
          if (dont_return_target)
@@ -3673,6 +3683,15 @@ store_constructor (exp, target, cleared)
              if (GET_CODE (to_rtx) != MEM)
                abort ();
 
+              if (GET_MODE (offset_rtx) != ptr_mode)
+                {
+#ifdef POINTERS_EXTEND_UNSIGNED
+                  offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1);
+#else
+                  offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
+#endif
+                }
+
              to_rtx
                = change_address (to_rtx, VOIDmode,
                                  gen_rtx_PLUS (ptr_mode, XEXP (to_rtx, 0),
@@ -5752,11 +5771,13 @@ expand_expr (exp, target, tmode, modifier)
              abort ();
 
            if (GET_MODE (offset_rtx) != ptr_mode)
+             {
 #ifdef POINTERS_EXTEND_UNSIGNED
-             offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1);
+               offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1);
 #else
-             offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
+               offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
 #endif
+             }
 
            op0 = change_address (op0, VOIDmode,
                                  gen_rtx_PLUS (ptr_mode, XEXP (op0, 0),