public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8912] libgcc: Fix a bug in _BitInt -> dfp conversions Date: Sat, 10 Feb 2024 11:53:06 +0000 (GMT) [thread overview] Message-ID: <20240210115306.087473858C20@sourceware.org> (raw) https://gcc.gnu.org/g:1e87fcf200897b64ca428c8ef80c3ad876828caf commit r14-8912-g1e87fcf200897b64ca428c8ef80c3ad876828caf Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Feb 10 12:51:39 2024 +0100 libgcc: Fix a bug in _BitInt -> dfp conversions The ia32 _BitInt support revealed a bug in floatbitint?d.c. As can be even guessed from how the code is written in the loop, the intention was to set inexact to non-zero whenever the remainder after division wasn't zero, but I've ended up just checking whether the 2 least significant limbs of the remainder were non-zero. Now, in the dfp/bitint-4.c test in one case the remainder happens to have least significant 64 bits zero and then the higher limbs are non-zero; with 32-bit limbs that means 2 least significant limbs are zero and so the code acted as if it was exactly divisible. Fixed thusly. 2024-02-10 Jakub Jelinek <jakub@redhat.com> * soft-fp/floatbitintdd.c (__bid_floatbitintdd): Or in all remainder limbs into inexact rather than just first two. * soft-fp/floatbitintsd.c (__bid_floatbitintsd): Likewise. * soft-fp/floatbitinttd.c (__bid_floatbitinttd): Likewise. Diff: --- libgcc/soft-fp/floatbitintdd.c | 2 +- libgcc/soft-fp/floatbitintsd.c | 2 +- libgcc/soft-fp/floatbitinttd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libgcc/soft-fp/floatbitintdd.c b/libgcc/soft-fp/floatbitintdd.c index 77c5fd75e0e3..456557294e7e 100644 --- a/libgcc/soft-fp/floatbitintdd.c +++ b/libgcc/soft-fp/floatbitintdd.c @@ -114,7 +114,7 @@ __bid_floatbitintdd (const UBILtype *i, SItype iprec) buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else { diff --git a/libgcc/soft-fp/floatbitintsd.c b/libgcc/soft-fp/floatbitintsd.c index 5c5ed6cfb7e0..4901aa82af7c 100644 --- a/libgcc/soft-fp/floatbitintsd.c +++ b/libgcc/soft-fp/floatbitintsd.c @@ -113,7 +113,7 @@ __bid_floatbitintsd (const UBILtype *i, SItype iprec) buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else { diff --git a/libgcc/soft-fp/floatbitinttd.c b/libgcc/soft-fp/floatbitinttd.c index 3bc18e201021..5fff339a8675 100644 --- a/libgcc/soft-fp/floatbitinttd.c +++ b/libgcc/soft-fp/floatbitinttd.c @@ -113,7 +113,7 @@ __bid_floatbitinttd (const UBILtype *i, SItype iprec) buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else {
reply other threads:[~2024-02-10 11:53 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240210115306.087473858C20@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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: linkBe 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).