Re: [PATCH] Fix undefined behaviour in arc port
authorJeff Law <law@gcc.gnu.org>
Mon, 28 Sep 2015 19:27:29 +0000 (13:27 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 28 Sep 2015 19:27:29 +0000 (13:27 -0600)
Re: [PATCH] Fix undefined behaviour in arc port
        * config/arc/arc.c (arc_legitimize_reload_address): Fix stupid
        thinko in last change.
        * config/arc/constraints.md (C2a): Fix typos in last change.

From-SVN: r228219

gcc/config/arc/arc.c
gcc/config/arc/constraints.md

index 4d731b53f6c5e0775fabd6905ee1c39071d36185..a6a1921267dc23426186ba3ae395b67f4fa429f0 100644 (file)
@@ -9322,7 +9322,7 @@ arc_legitimize_reload_address (rtx *p, machine_mode mode, int opnum,
       shift = scale >> 1;
       offset_base
        = ((offset + (256 << shift))
-          & ((HOST_WIDE_INT)(-512U << shift)));
+          & ((HOST_WIDE_INT)((unsigned HOST_WIDE_INT) -512 << shift)));
       /* Sometimes the normal form does not suit DImode.  We
         could avoid that by using smaller ranges, but that
         would give less optimized code when SImode is
index b3ea115fc03496b5cb5c32f373e1f9089a832185..3d0db360557e4c1a714ea7271a08032fc96d507b 100644 (file)
   "@internal
    Unconditional two-address add / sub constant"
   (and (match_code "const_int")
-       (match_test "ival == HOST_WIDE_INT (HOST_WIDE_INT_M1U << 31)
+       (match_test "ival == (HOST_WIDE_INT) (HOST_WIDE_INT_M1U << 31)
                    || (ival >= -0x4000 && ival <= 0x4000
                        && ((ival >= 0 ? ival : -ival)
                            <= 0x7ff * (ival & -ival)))")))