OSDN Git Service

d
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Dec 1997 13:15:21 +0000 (13:15 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Dec 1997 13:15:21 +0000 (13:15 +0000)
        * expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF, if the
        offset's mode is not ptr_mode, convert it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17260 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expr.c

index 68fbbe9..623a903 100644 (file)
@@ -5739,6 +5739,14 @@ expand_expr (exp, target, tmode, modifier)
 
            if (GET_CODE (op0) != 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
+
            op0 = change_address (op0, VOIDmode,
                                  gen_rtx (PLUS, ptr_mode, XEXP (op0, 0),
                                           force_reg (ptr_mode, offset_rtx)));