From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 9C356385840E; Fri, 9 Feb 2024 17:39:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C356385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707500362; bh=h221jbK8u3CsmtGYzjvCozIHZH5ocLLrezL59HuVFmI=; h=From:To:Subject:Date:From; b=SK4DH86hWsIutJnVyQOk9TreRUcMNQxOOst+SNQGMmhmgpuDpEwoNxkT9jI7EdLOr n0GxufBNGQ0iHLPjoRozROponniXVTtAIway85uy/GTs6ZfLWPlYKjlJmBM4S7ZE0x IgYT3ZYAwWe08OxuQrBSBie4d/5/UdxhLHPydmoI= 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: 55f60dad7faafe3676c8cb926a081d99dc686d6b X-Git-Newrev: 102f6424791ee49c9600898dc9312ba278a7f8c5 Message-Id: <20240209173922.9C356385840E@sourceware.org> Date: Fri, 9 Feb 2024 17:39:22 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=102f6424791ee49c9600898dc9312ba278a7f8c5 commit 102f6424791ee49c9600898dc9312ba278a7f8c5 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