[PATCH] Fix undefined behaviour in msp430 port
[gcc.git] / gcc / config / msp430 / msp430.c
index d2308cb064d1b4dcdcb0be50fb8bf3e0538509bc..ba8d862884604e3d901f7576603bd59b479f44bb 100644 (file)
@@ -998,7 +998,7 @@ msp430_legitimate_constant (machine_mode mode, rtx x)
     /* GCC does not know the width of the PSImode, so make
        sure that it does not try to use a constant value that
        is out of range.  */
-    || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (-1 << 20));
+    || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (HOST_WIDE_INT)(HOST_WIDE_INT_M1U << 20));
 }
 
 \f