From patchwork Tue Oct 3 17:28:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 820968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-85305-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="cphRm8ZG"; dkim-atps=neutral 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 3y65bl5p2tz9sxR for ; Wed, 4 Oct 2017 04:28:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:content-type; q=dns; s=default; b=pewtg0WIAGA78BaMrJFgH Q3/WGbxujX+xnqGXuZiq4R4Y2JgVmFFKyCLj9syKh+/a9rXORZ00hr+j/EeOKOEJ U8G83iYa2FQ54m+jAMzwjLCawdUv2EaHKxQA4fT/DpAUH0WoEsg2lEUr2lE2VvBh J9zZ6ksDy+Ji8we3WiwofY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:content-type; s=default; bh=lbNVsrNUlqxcfzr4IfisjPg/VpQ =; b=cphRm8ZGCXkLYjPJKi6s2ou3KoNJ41c+72vKmR0rmAH7b9nb8Fh1B4P0S8h O5DVvfRDU7YnX4MPAknj8vsHVX3ah0+F4Y5JqI8u43/qkWnW/9lHxiGfG+/Dq3gv bfLbqhYXyK2Y0Kq55xDHYudIvZGUs0r95imI0Jb7QyXj2Uz8= Received: (qmail 59453 invoked by alias); 3 Oct 2017 17:28:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 59438 invoked by uid 89); 3 Oct 2017 17:28:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=n0 X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Message-ID: <59D3C8B2.9020204@arm.com> Date: Tue, 03 Oct 2017 18:28:18 +0100 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: GNU C Library CC: nd@arm.com Subject: [PATCH][BZ #22244] Fix yn(n,0) without SVID wrapper X-ClientProxiedBy: HE1PR0402CA0018.eurprd04.prod.outlook.com (2603:10a6:3:d0::28) To DB6PR0802MB2485.eurprd08.prod.outlook.com (2603:10a6:4:9b::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a2b0ad5-7448-4361-7eeb-08d50a8425b7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(49563074)(201703131423075)(201703031133081)(201702281549075); SRVR:DB6PR0802MB2485; X-Microsoft-Exchange-Diagnostics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3nyk6//YwfttrvzMV7kvwCoEvB1ftXB+/llaOW7Q=; 4:oEEUiOwQIqZn7LvGesV/Mx5m40gTPTft54H0CQqxCGMIC6g0+qVsMEloxxqN0pa5p0t6BynxDPRoyB+1ykLPd0w+LXHXs50Tq4p6lLu6WqV+ZxCogtQSn+s0tM1ypS05TpGY5aWMShbatpHCe2grUcnfrl7ZC2R/LFWSqpYzgMUpobgtgnUSEQsm5/WIXIEb5uqzO1lao570SG3sV7JKa6naJjCIaisE6+P3ZnBs6qAHWrNT2lRvvnRyz/LEZZU5Gh+2i4hDpbdNE3fYucBjsqY/A4ZxZzSKYFsRjJwG2z0= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0802MB2485; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0802MB2485; X-Forefront-PRVS: 044968D9E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(346002)(376002)(39860400002)(189002)(377424004)(199003)(2906002)(16576012)(64126003)(16586007)(305945005)(21490400003)(77096006)(5660300001)(50986999)(6486002)(189998001)(87266999)(54356999)(101416001)(65816999)(4610100001)(5000100001)(80316001)(84326002)(5890100001)(58126008)(86362001)(7736002)(68736007)(16526017)(97736004)(316002)(83506001)(8936002)(4326008)(568964002)(33656002)(270700001)(53936002)(478600001)(59896002)(72206003)(6116002)(2476003)(25786009)(3846002)(6666003)(106356001)(36756003)(105586002)(6916009)(81156014)(8676002)(65806001)(66066001)(65956001)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2485; H:[10.2.206.69]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2485; 23:BbPpxmxRHKCr4oXU7nyX30SqZt8P7HVFKYS2DiEB/zDF9J46MZCsM16F+rzez8UfFy0SDdrejZ1RzvmgHP9t4NRGBjum1fhjsH3KNxysgKPqRmyzlOW8YNub2btvDIcFON0Uut9L8h5ZWv1jOyvARmd0Qcfzv5T4Q2EStyO1UCkHkshCXMGEcjuZtfArMFFzV4KRDzF8QzH31ILVEarNDtoBGHOX4DXQijOzGn8WO1UfTPFOMOKfG6gj7d55kfm6nJTaIJzv2zI5GEN/iZ5D6WClGkTnJK3x8f1i7nGmO88mlGpVGYYva/bRvS3D1YPg71wpUc+RpXXe8wtnD0oL1OI0l6ySG7rH1rUOiTtRyRzKhAXPWv+AfG7P+rRe6OOMySNMFQgTRdrUaICsiqCTJdyBscKauYM5ov86z/n7nvuBJfjzFqGq7YAo+csXu1ye1fBRk6U+LnvXSCKJ+WDXrZbc4u3MG7waTneMsRc6tifb+Yo3YecLpbmWvM9MtabzcCxOnG/WUTy6vabjWKUq2YZwmZOxw0D3ylsOCbIVpo4iQT0eFKYAZK/wNcM3mEzZ9Cf+YLC7NVQn/96dU9bZ8/g8ewpbt6ml4nk2R0szVfr64sXxy0/BEFNvWRRiwunlO/8PorBiNhSQ5ep29QRqIrtrIB5Ob4ivJHNCfQN6dr+ANz0HzHZ7LJJet0t1CXASelBAQvVC5KMCO18SA/AryY2ks54NV6kvGBOp/G1Yh/sbuOCc0IsPtW2zvLpuO+QrbeS9wBnitxIZPnB5SEqIPqz5bqgrvA3xiwc+hWZfwEAFBh1zs4YF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12wFBNE8G+zb1+Evk18NtyHI2PuBjyAMiWWFenES34ivgke99aEBviKWFI1j6btyAW4A1bU=; 24:52EC8rJcIKLRFMArF4j5dIfQWJVl/0z5lCw57w4nYhROnnpjs8fta+9xJ3AgeFF7tXx0FwSyhJXxp24kE8xTLXIFD5nifOomZFuIgOUGHAg=; 7:mlrkEv0yKrM9CbnkPnN63k2b5YKgJBUMUrhP3o5zkRncmtoFO27ASZY9UA06TkDhF8vgAkeGFJgOMydpacVZAWUjJZ5/DdRv+yvQH5P7VqWAdvfeU7gC3ys8HEkHMy/VLqJ3hJs8AX7SjRj0RZOJeEPEYJcXTMvtFSNpN7T4im7YU0wz5g6un/kDg5TuuYmMWUeU8g3G37AKWdU4nObLzjj6TiURS/bwAX1o1hUAwy0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2017 17:28:22.3005 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2485 Without SVID compat wrapper yn(n,0) and ynf(n,0) does not raise the divide-by-zero excpetion and it may return inf with the wrong sign for n < 0. 2017-10-03 Szabolcs Nagy [BZ #22244] * sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_yn): Fix x == 0 case. * sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise. diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index 3ac91df2b0..4efeec402b 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -268,8 +268,6 @@ __ieee754_yn (int n, double x) /* if Y(n,NaN) is NaN */ if (__glibc_unlikely ((ix | ((uint32_t) (lx | -lx)) >> 31) > 0x7ff00000)) return x + x; - if (__glibc_unlikely ((ix | lx) == 0)) - return -HUGE_VAL + x; /* -inf and overflow exception. */; if (__glibc_unlikely (hx < 0)) return zero / (zero * x); @@ -281,6 +279,8 @@ __ieee754_yn (int n, double x) } if (n == 0) return (__ieee754_y0 (x)); + if (__glibc_unlikely ((ix | lx) == 0)) + return -sign / zero; { SET_RESTORE_ROUND (FE_TONEAREST); if (n == 1) diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c index 82b9ba3300..da014ac1ed 100644 --- a/sysdeps/ieee754/flt-32/e_jnf.c +++ b/sysdeps/ieee754/flt-32/e_jnf.c @@ -194,8 +194,6 @@ __ieee754_ynf(int n, float x) ix = 0x7fffffff&hx; /* if Y(n,NaN) is NaN */ if(__builtin_expect(ix>0x7f800000, 0)) return x+x; - if(__builtin_expect(ix==0, 0)) - return -HUGE_VALF+x; /* -inf and overflow exception. */ if(__builtin_expect(hx<0, 0)) return zero/(zero*x); sign = 1; if(n<0){ @@ -203,6 +201,8 @@ __ieee754_ynf(int n, float x) sign = 1 - ((n&1)<<1); } if(n==0) return(__ieee754_y0f(x)); + if(__builtin_expect(ix==0, 0)) + return -sign/zero; SET_RESTORE_ROUNDF (FE_TONEAREST); if(n==1) { ret = sign*__ieee754_y1f(x);