From patchwork Wed Apr 22 17:49:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 6385 Received: (qmail 10884 invoked by alias); 22 Apr 2015 17:49:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10211 invoked by uid 89); 22 Apr 2015 17:49:25 -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, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 22 Apr 2015 17:49:25 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Apr 2015 18:49:21 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 22 Apr 2015 18:49:18 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5E3921B0804B for ; Wed, 22 Apr 2015 18:49:55 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t3MHnImN6488406 for ; Wed, 22 Apr 2015 17:49:18 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t3MHnDB1003753 for ; Wed, 22 Apr 2015 11:49:16 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-115.boeblingen.de.ibm.com [9.152.212.115]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t3MHnAAo003713; Wed, 22 Apr 2015 11:49:11 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Sergio Durigan Junior , Ulrich Weigand Subject: [PATCH 1/4] S390: For zero, let is_power_of_two() return false References: <1429724743-4603-1-git-send-email-arnez@linux.vnet.ibm.com> Date: Wed, 22 Apr 2015 19:49:11 +0200 In-Reply-To: <1429724743-4603-1-git-send-email-arnez@linux.vnet.ibm.com> (Andreas Arnez's message of "Wed, 22 Apr 2015 19:44:59 +0200") Message-ID: <87h9s88354.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15042217-0013-0000-0000-000003BEB6D6 X-IsSubscribed: yes This fixes a minor issue with the helper function is_power_of_two(), which returned non-zero ("true") if the argument was zero. This led to a wrong decision when passing a zero-sized struct in an inferior function call. gdb/ChangeLog: * s390-linux-tdep.c (is_power_of_two): Add comment. Return false if the argument is zero. --- gdb/s390-linux-tdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index b83a264..44feee7 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -2484,11 +2484,12 @@ is_float_like (struct type *type) || is_float_singleton (type)); } +/* Determine whether N is a power of two. */ static int is_power_of_two (unsigned int n) { - return ((n & (n - 1)) == 0); + return n && ((n & (n - 1)) == 0); } /* Return non-zero if TYPE should be passed as a pointer to a copy,