diff mbox

Fix undefined behaviour in rl78 port

Message ID 560ABC49.8020706@redhat.com
State New
Headers show

Commit Message

Jeff Law Sept. 29, 2015, 4:28 p.m. UTC
And in the rl78 port.  Tested by building the rl78 targets in config-all.mk.

Installed on the trunk.

Jeff
commit 6d8cde85a30e36e5b5842b8d66837a8b4815d197
Author: Jeff Law <law@tor.usersys.redhat.com>
Date:   Mon Sep 28 19:25:04 2015 -0400

    [PATCH] Fix undefined behaviour in rl78 port
            * config/rl78/rl78-expand.md (movqi): Fix undefined left shift
            behaviour.
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1b9985a..79dc89f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@ 
 2015-09-29  Jeff Law  <law@redhat.com>
 
+	* config/rl78/rl78-expand.md (movqi): Fix undefined left shift
+	behaviour.
+
 	* config/msp430/msp430.c (msp430_legitimate_constant): Fix undefined
 	left shift behaviour.
 	* config/msp430/constraints.md ('L' constraint): Similarly.
diff --git a/gcc/config/rl78/rl78-expand.md b/gcc/config/rl78/rl78-expand.md
index 0335a4d..67e6620 100644
--- a/gcc/config/rl78/rl78-expand.md
+++ b/gcc/config/rl78/rl78-expand.md
@@ -48,7 +48,7 @@ 
 	&& ! REG_P (operands[0]))
 	operands[1] = copy_to_mode_reg (QImode, operands[1]);
 
-    if (CONST_INT_P (operands[1]) && ! IN_RANGE (INTVAL (operands[1]), (-1 << 8) + 1, (1 << 8) - 1))
+    if (CONST_INT_P (operands[1]) && ! IN_RANGE (INTVAL (operands[1]), (HOST_WIDE_INT_M1U << 8) + 1, (1 << 8) - 1))
       FAIL;
   }
 )