From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id BB3323858427; Wed, 7 Feb 2024 14:14:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB3323858427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707315275; bh=dmPpGUuWdKy6mNVqC7dz+1HAWGNHUKozslyxEX5BswQ=; h=From:To:Subject:Date:From; b=oU/KfhWqnzSZPCfUpURg9Ulv1kMWVeW2jV4rsxOtMhZ7or+RLCJcmbge6v4w4lM+q kDkyeqD5bQFT9cwoc/HrV2IF31hQnvi8YGvitvB2Gl6YA10c5DsfFPgmJZ62mXMzKR 2SI62bpvEpezm05it++m7kPsuoli9v6Qs9Bgubjo= 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: 07525b9fd05a0650c88180a5f29ec50426a1a438 X-Git-Newrev: c16ba7dc012dcecf73a058f00be5e44f416753b1 Message-Id: <20240207141435.BB3323858427@sourceware.org> Date: Wed, 7 Feb 2024 14:14:35 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c16ba7dc012dcecf73a058f00be5e44f416753b1 commit c16ba7dc012dcecf73a058f00be5e44f416753b1 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