Fix HWI + -unsigned in combine.c
authorRichard Sandiford <richard.sandiford@linaro.org>
Mon, 23 Oct 2017 06:07:26 +0000 (06:07 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 23 Oct 2017 06:07:26 +0000 (06:07 +0000)
rtx_equal_for_field_assignment_p had:

  x = adjust_address_nv (x, GET_MODE (y),
       -subreg_lowpart_offset (GET_MODE (x),
       GET_MODE (y)));

But subreg_lowpart_offset returns an unsigned int and
adjust_address_nv takes a HWI, so a subreg offset of 4 would
give a memory offset of 0x00000000fffffffffc.

2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* combine.c (rtx_equal_for_field_assignment_p): Use
byte_lowpart_offset.

From-SVN: r253997

gcc/ChangeLog
gcc/combine.c

index 1bc0f001cc277f6aad3aeed063f453a57d48fac0..6caddb801b7dd44089f2a86a44dbd0d0fa299ef7 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * combine.c (rtx_equal_for_field_assignment_p): Use
+       byte_lowpart_offset.
+
 2017-10-22  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index e5c276901d8d0e3140849ae230567bd2fb405ae4..d71e50fdefb59bd8bbd2224df20900655375dee7 100644 (file)
@@ -9526,13 +9526,9 @@ rtx_equal_for_field_assignment_p (rtx x, rtx y, bool widen_x)
        return 0;
       if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
        return 0;
-      /* For big endian, adjust the memory offset.  */
-      if (BYTES_BIG_ENDIAN)
-       x = adjust_address_nv (x, GET_MODE (y),
-                              -subreg_lowpart_offset (GET_MODE (x),
-                                                      GET_MODE (y)));
-      else
-       x = adjust_address_nv (x, GET_MODE (y), 0);
+      x = adjust_address_nv (x, GET_MODE (y),
+                            byte_lowpart_offset (GET_MODE (y),
+                                                 GET_MODE (x)));
     }
 
   if (x == y || rtx_equal_p (x, y))