From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from donkey.elm.relay.mailchannels.net (donkey.elm.relay.mailchannels.net [23.83.212.49]) by sourceware.org (Postfix) with ESMTPS id 7B58B389201A for ; Wed, 23 Dec 2020 11:56:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7B58B389201A X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1D51F321973; Wed, 23 Dec 2020 11:56:26 +0000 (UTC) Received: from pdx1-sub0-mail-a1.g.dreamhost.com (100-105-161-17.trex.outbound.svc.cluster.local [100.105.161.17]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8B7783218F0; Wed, 23 Dec 2020 11:56:25 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a1.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.11); Wed, 23 Dec 2020 11:56:26 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Suffer-Obese: 566168023aca5d39_1608724585835_2940522322 X-MC-Loop-Signature: 1608724585835:3445465596 X-MC-Ingress-Time: 1608724585834 Received: from pdx1-sub0-mail-a1.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a1.g.dreamhost.com (Postfix) with ESMTP id 4E2907F0A4; Wed, 23 Dec 2020 03:56:25 -0800 (PST) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a1.g.dreamhost.com (Postfix) with ESMTPSA id E8A137F0A6; Wed, 23 Dec 2020 03:56:22 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a1 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, fweimer@redhat.com, joseph@codesourcery.com Subject: [PATCH v2 3/5] Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61 Date: Wed, 23 Dec 2020 17:26:00 +0530 Message-Id: <20201223115602.3472627-4-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223115602.3472627-1-siddhesh@sourceware.org> References: <20201223115602.3472627-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2020 11:56:29 -0000 Do not attempt to fix the significand top bit in long double input received in printf. The code should never reach here because isnan should now detect unnormals as NaN. This is already a NOP for glibc since it uses the gcc __builtin_isnan, which detects unnormals as NaN. --- sysdeps/x86/ldbl2mpn.c | 8 -------- sysdeps/x86/tst-ldbl-nonnormal-printf.c | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/sysdeps/x86/ldbl2mpn.c b/sysdeps/x86/ldbl2mpn.c index 23afedfb67..ec8464eef7 100644 --- a/sysdeps/x86/ldbl2mpn.c +++ b/sysdeps/x86/ldbl2mpn.c @@ -115,14 +115,6 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t= size, && res_ptr[N - 1] =3D=3D 0) /* Pseudo zero. */ *expt =3D 0; - else - /* Unlike other floating point formats, the most significant bit - is explicit and expected to be set for normal numbers. Set it - in case it is cleared in the input. Otherwise, callers will - not be able to produce the expected multi-precision integer - layout by shifting. */ - res_ptr[N - 1] |=3D (mp_limb_t) 1 << (LDBL_MANT_DIG - 1 - - ((N - 1) * BITS_PER_MP_LIMB)); =20 return N; } diff --git a/sysdeps/x86/tst-ldbl-nonnormal-printf.c b/sysdeps/x86/tst-ld= bl-nonnormal-printf.c index 54381ece0b..2b513960a7 100644 --- a/sysdeps/x86/tst-ldbl-nonnormal-printf.c +++ b/sysdeps/x86/tst-ldbl-nonnormal-printf.c @@ -42,10 +42,7 @@ do_test (void) char buf[30]; int ret =3D snprintf (buf, sizeof (buf), "%Lg", value); TEST_COMPARE (ret, strlen (buf)); - if (strcmp (buf, "nan") !=3D 0) - /* If snprintf does not recognize the non-normal number as a NaN, - it has added the missing explicit MSB. */ - TEST_COMPARE_STRING (buf, "3.02201e-4624"); + TEST_COMPARE_STRING (buf, "nan"); return 0; } =20 --=20 2.29.2