From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 0089B3861871; Wed, 17 Apr 2024 20:14:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0089B3861871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713384888; bh=jE717QERMxbrLNBKckIA4tr8+hvGbNjsA5MKgytS6ls=; h=From:To:Subject:Date:From; b=vq2pslRO4jK3WJkNiRxGrQZ4OUAyMLpBCTZvdyLXb2ZLJGfHHfAeY1D+woe2ccTqr DRlVfacBE8BE223mAzi1abK4Z+26xOQoOyGYYT5qY7bUEmJJ/4gJ/LlNmz8YhJNBgC 716R2ub5cWIreoHpFMZk/UlTX/714aOp8p3CkuQ0= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] math: Fix potential underflow on ldbl-128 erfl X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: ae79f00a76b53d276ff27e9097db1186590a068c X-Git-Newrev: 3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21 Message-Id: <20240417201448.0089B3861871@sourceware.org> Date: Wed, 17 Apr 2024 20:14:47 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21 commit 3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21 Author: Adhemerval Zanella Date: Tue Jan 30 13:45:14 2024 +0000 math: Fix potential underflow on ldbl-128 erfl The multiplication is only required if the branch is taken, and the compiler might not optimize it away. Checked on aarch64-linux-gnu with gcc and clang. Diff: --- sysdeps/ieee754/ldbl-128/s_erfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c index 1cbedc249d..e52d88bde3 100644 --- a/sysdeps/ieee754/ldbl-128/s_erfl.c +++ b/sysdeps/ieee754/ldbl-128/s_erfl.c @@ -778,7 +778,6 @@ __erfl (_Float128 x) } u.parts32.w0 = ix; a = u.value; - z = x * x; if (ix < 0x3ffec000) /* a < 0.875 */ { if (ix < 0x3fc60000) /* |x|<2**-57 */ @@ -792,6 +791,7 @@ __erfl (_Float128 x) } return x + efx * x; } + z = x * x; y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1); } else