[PATCH] Fix undefined behaviour in SH port
authorJeff Law <law@redhat.com>
Sat, 26 Sep 2015 07:42:32 +0000 (01:42 -0600)
committerJeff Law <law@gcc.gnu.org>
Sat, 26 Sep 2015 07:42:32 +0000 (01:42 -0600)
    [PATCH] Fix undefined behaviour in SH port
* config/sh/sh.h (CONST_OK_FOR_J16): Fix left shift undefined
behaviour

From-SVN: r228165

gcc/ChangeLog
gcc/config/sh/sh.h

index 6887b14fde3035288f290bd01a55b9dcd53ed161..28c6bf7fcc93b1f5e542bca050b9dba58d644873 100644 (file)
@@ -1,5 +1,8 @@
 2015-09-26  Jeff Law  <law@redhat.com>
 
+       * config/sh/sh.h (CONST_OK_FOR_J16): Fix left shift undefined
+       behaviour
+
        * config/mips/mips.c (mips_compute_frame_info): Fix left shift
        undefined behaviour.
 
index 7aa489d6dc045a13a83994fab0d78cabf3204d6e..b18cc1fedc1a6a10de8aa5853294c5d5d7f6e17e 100644 (file)
@@ -1176,7 +1176,7 @@ extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 #define CONST_OK_FOR_J16(VALUE) \
   ((HOST_BITS_PER_WIDE_INT >= 64 && (VALUE) == (HOST_WIDE_INT) 0xffffffff) \
-   || (HOST_BITS_PER_WIDE_INT >= 64 && (VALUE) == (HOST_WIDE_INT) -1 << 32))
+   || (HOST_BITS_PER_WIDE_INT >= 64 && (VALUE) == (HOST_WIDE_INT) (HOST_WIDE_INT_M1U << 32)))
 
 #define CONST_OK_FOR_K08(VALUE) (((HOST_WIDE_INT)(VALUE))>= 0 \
                                 && ((HOST_WIDE_INT)(VALUE)) <= 255)