From patchwork Tue Sep 29 16:28:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 523952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 541DF140082 for ; Wed, 30 Sep 2015 02:29:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fVg+85XY; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ijP6feV1S6fDppfWCqKK2TncRVisEOZX+3Yeke4m271YynuC48 B4CGpQeh0y2IkSzRX6pfM/mzOcOsawycc1UqcL0+gmiZeNfH1ADk2/fkQl8YAN/H l1ya7wstvhj+/SvwJb7au085u9qHJw0c4CrbhL3qHdFLz8vNTXIapl+iE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=NpIv9Uq/XAGz92iSu8ELap5/Sk4=; b=fVg+85XY/kYTBT0vYHtZ cATFgLrkT5dPyZyYEtnp0G9m/MSZPsDB1xnGtxQGTOkkCpahbmgH5KGg9tlQNDi1 CERJgAYEUoM7vUkDwqhfb9KV2MKdFReSs5H/0sm1o/u5GnLMzZfAGQSUFmkRxSEy WgfYyGIW5e+/xec3/FJYJnU= Received: (qmail 102647 invoked by alias); 29 Sep 2015 16:29:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101832 invoked by uid 89); 29 Sep 2015 16:29:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 29 Sep 2015 16:28:59 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 598628E70B for ; Tue, 29 Sep 2015 16:28:58 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-59.phx2.redhat.com [10.3.113.59]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8TGSvN0017577 for ; Tue, 29 Sep 2015 12:28:58 -0400 To: gcc-patches@gcc.gnu.org From: Jeff Law Subject: [PATCH] Fix undefined behaviour in rl78 port Message-ID: <560ABC49.8020706@redhat.com> Date: Tue, 29 Sep 2015 10:28:57 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-IsSubscribed: yes 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 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 --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 + * 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; } )