From patchwork Sat Sep 26 07:38:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 523075 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 1A412140549 for ; Sat, 26 Sep 2015 17:39:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Gw4U1yLz; 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=rJWpsNUK2YUGTdofLkLTRxrHVCjLfv0ZJOf+3PpIWgU7b9iAUA x5Bq0NUNKhLKASu4yaIbhPTL9k6lkvyls9mDyqHZ2KmWJ+kK8lCLWA4iam5r64oe qdkD5dElbj+JngpTOG51pyh1YX/A5wDkZw3I12VFDcBo/LGRfjyZsJ5j0= 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=A5GFZbD17lbBzgqlInq5JeYZs/0=; b=Gw4U1yLzTSunInzinxam 20kZiriTz5HRgf/h2nqacexAlk0TLLI9X61C/BIjH7Xqdv/rAJUffH3f90RAlYM1 ev5ksyd7XIyh0GHbDf7LPDBhk+neL2zZXqv3ukks5rXcC3vd2qfbgkSl2MftcZ5v eqGM3ttP0HsOjuTQxCw/cfc= Received: (qmail 9871 invoked by alias); 26 Sep 2015 07:38:55 -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 9858 invoked by uid 89); 26 Sep 2015 07:38:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Sat, 26 Sep 2015 07:38:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 346D498C05 for ; Sat, 26 Sep 2015 07:38:52 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-43.phx2.redhat.com [10.3.113.43]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8Q7cpQj027976 for ; Sat, 26 Sep 2015 03:38:51 -0400 To: gcc-patches@gcc.gnu.org From: Jeff Law Subject: [PATCH] Fix undefined behaviour in mips port Message-ID: <56064B8B.5030305@redhat.com> Date: Sat, 26 Sep 2015 01:38:51 -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 Another instance of left shifting a negative value. Fixed in an obvious way. Verified all the mips configurations in config-list.mk build now using a trunk compiler. Installed on the trunk, Jeff commit fff8087106b686a8c0ac6c7dab3dd7e12cd717ba Author: Jeff Law Date: Sat Sep 26 03:24:00 2015 -0400 [PATCH] Fix undefined behaviour in mips port * config/mips/mips.c (mips_compute_frame_info): Fix left shift undefined behaviour. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 98c1bd9..6887b14 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2015-09-26 Jeff Law + * config/mips/mips.c (mips_compute_frame_info): Fix left shift + undefined behaviour. + * config/cris/cris.md (asrandb): Fix left shift undefined behaviour. (asrandw): Likewise. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 0e0ecf2..456db08 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -10572,7 +10572,7 @@ mips_compute_frame_info (void) if (mips_save_reg_p (regno)) { frame->num_fp += MAX_FPRS_PER_FMT; - frame->fmask |= ~(~0 << MAX_FPRS_PER_FMT) << (regno - FP_REG_FIRST); + frame->fmask |= ~(~0U << MAX_FPRS_PER_FMT) << (regno - FP_REG_FIRST); } /* Move above the FPR save area. */