From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31566 invoked by alias); 10 Nov 2015 22:42:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31552 invoked by uid 89); 10 Nov 2015 22:42:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 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; Tue, 10 Nov 2015 22:42:46 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 56AE65BA08 for ; Tue, 10 Nov 2015 22:42:45 +0000 (UTC) Received: from pinnacle.lan (ovpn-113-161.phx2.redhat.com [10.3.113.161]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAAMgiKn012964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Tue, 10 Nov 2015 17:42:45 -0500 Date: Tue, 10 Nov 2015 22:42:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH 0/2] Fix invalid left shift of negative value. Message-ID: <20151110154243.43d38f49@pinnacle.lan> In-Reply-To: <20151110111638.GD17214@linux.vnet.ibm.com> References: <20151110111638.GD17214@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00266.txt.bz2 On Tue, 10 Nov 2015 12:16:38 +0100 Dominik Vogt wrote: > The following series of patches fixes all occurences of > left-shifting negative constants in C code which is undefined by > the C standard. The patches have been tested on s390x, covering > only a small subset of the changes. Looking at one of your changes from part 1/2... - (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); + -((LONGEST) 1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1)); What aspect of the original expression is not defined by the C standard? (I'm looking at an old copy of Harbison & Steel; the original expression looks okay to me, but perhaps I'm missing something...) FWIW, I have an easier time understanding the intent of the first/original expression than your proposed replacement. Kevin