public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] math: Fix potential underflow on ldbl-128 erfl
Date: Wed, 17 Apr 2024 20:14:47 +0000 (GMT)	[thread overview]
Message-ID: <20240417201448.0089B3861871@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21

commit 3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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

             reply	other threads:[~2024-04-17 20:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 20:14 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 16:00 Adhemerval Zanella
2024-02-09 17:39 Adhemerval Zanella
2024-02-07 14:14 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240417201448.0089B3861871@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).