From patchwork Mon Dec 11 14:29:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 24854 Received: (qmail 40833 invoked by alias); 11 Dec 2017 14:29:19 -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 40821 invoked by uid 89); 11 Dec 2017 14:29:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Dec 2017 14:29:17 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBBERKtb014043 for ; Mon, 11 Dec 2017 09:29:15 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2esusug4fa-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 11 Dec 2017 09:29:15 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Dec 2017 14:29:13 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 11 Dec 2017 14:29:10 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBBETAl61835440 for ; Mon, 11 Dec 2017 14:29:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44322AE056 for ; Mon, 11 Dec 2017 14:21:59 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C458AE053 for ; Mon, 11 Dec 2017 14:21:59 +0000 (GMT) Received: from oc3748833570.ibm.com (unknown [9.152.213.29]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Mon, 11 Dec 2017 14:21:59 +0000 (GMT) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id E5606D80340; Mon, 11 Dec 2017 15:29:08 +0100 (CET) Subject: [pushed, MPFR] Fix regression on 32-bit host systems To: gdb-patches@sourceware.org Date: Mon, 11 Dec 2017 15:29:08 +0100 (CET) From: "Ulrich Weigand" MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17121114-0012-0000-0000-00000597BFD1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121114-0013-0000-0000-00001912D04B Message-Id: <20171211142908.E5606D80340@oc3748833570.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-11_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712110216 Hello, when converting parts of the mantissa to MPFR, we need to make sure to do an *unsigned* conversion. Since we convert at most 32 bits at a time, stored in an unsigned long, this doesn't matter on systems where "long" is larger than 32 bits. But on systems where it is 32 bits, we can get conversion errors. Tested on x86_64-linux and i686-linux, pushed to mainline. Bye, Ulrich gdb/ChangeLog 2017-12-11 Ulrich Weigand * target-float.c (mpfr_float_ops::from_target): Use mpfr_set_ui instead of mpfr_set_si to convert mantissa bits. diff --git a/gdb/target-float.c b/gdb/target-float.c index b40b641..9b14609 100644 --- a/gdb/target-float.c +++ b/gdb/target-float.c @@ -1312,7 +1312,7 @@ mpfr_float_ops::from_target (const struct floatformat *fmt, mant = get_field (from, order, fmt->totalsize, mant_off, mant_bits); - mpfr_set_si (tmp.val, mant, MPFR_RNDN); + mpfr_set_ui (tmp.val, mant, MPFR_RNDN); mpfr_mul_2si (tmp.val, tmp.val, exponent - mant_bits, MPFR_RNDN); mpfr_add (to.val, to.val, tmp.val, MPFR_RNDN); exponent -= mant_bits;