Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Robert Dubner <rdubner@symas.com>
To: gdb-patches@sourceware.org
Cc: stephan.rohr@intel.com
Subject: [PATCH v4 0/5] gdb: Fix target floating-point encoding and signed-zero negation
Date: Wed, 11 Nov 2026 12:42:42 -0500	[thread overview]
Message-ID: <20261111174247.3382098-1-rdubner@symas.com> (raw)

This series fixes floating-point encoding, subnormal rounding, and
signed-zero handling in GDB.

It brings together the previously submitted neighboring-bit, subnormal,
and signed-zero fixes, followed by a fix for oversized shifts in
put_field.  It incorporates Stephan Rohr's review feedback, including
unit tests in target-float.c and conditional _Float128 coverage for
unary negation.

The five patches make the following changes.

1. Preserve neighboring bits when writing a floating-point field that
   occupies only part of a byte.

2. Encode subnormal values correctly and carry MPFR ternary results
   through subnormal rounding to avoid double rounding.

3. Preserve signed zero during MPFR target conversions, while retaining
   existing zero encodings for formats without signed-zero support.

4. Implement floating-point unary negation by multiplication by -1,
   preserving the existing integer and fixed-point behavior.

5. Avoid shifts greater than or equal to the width of unsigned long
   when writing fields wider than stuff_to_put.

The series was applied in order to a clean branch based on gdb/master
at 9db3b515b964.

Validation on x86_64 GNU/Linux completed successfully.

- GDB build
- All seven target-float selftests
- gdb.base/float-neg.exp, with 53 expected passes, including _Float128

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34927

Robert Dubner (5):
  gdb: Preserve neighboring bits when writing floating-point fields
  gdb: Preserve subnormal values in target floating-point operations
  gdb: Preserve signed zero in MPFR target conversions
  gdb: Preserve signed zero in floating-point unary negation
  gdb: Avoid oversized shifts when writing floating-point fields

 gdb/target-float.c                   | 660 ++++++++++++++++++++++++---
 gdb/testsuite/gdb.base/float-neg.c   |  36 ++
 gdb/testsuite/gdb.base/float-neg.exp |  79 ++++
 gdb/valarith.c                       |   8 +-
 4 files changed, 727 insertions(+), 56 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/float-neg.c
 create mode 100644 gdb/testsuite/gdb.base/float-neg.exp


base-commit: 9db3b515b964c1bbdc4d20c1202fbf27719be269
-- 
2.34.1


             reply	other threads:[~2026-11-11 17:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 17:42 Robert Dubner [this message]
2026-11-11 17:42 ` [PATCH v4 1/5] gdb: Preserve neighboring bits when writing floating-point fields Robert Dubner
2026-11-12  9:04   ` Rohr, Stephan
2026-11-11 17:42 ` [PATCH v4 2/5] gdb: Preserve subnormal values in target floating-point operations Robert Dubner
2026-11-12  9:25   ` Rohr, Stephan
2026-11-11 17:42 ` [PATCH v4 3/5] gdb: Preserve signed zero in MPFR target conversions Robert Dubner
2026-11-12  9:30   ` Rohr, Stephan
2026-11-11 17:42 ` [PATCH v4 4/5] gdb: Preserve signed zero in floating-point unary negation Robert Dubner
2026-11-12  9:32   ` Rohr, Stephan
2026-11-11 17:42 ` [PATCH v4 5/5] gdb: Avoid oversized shifts when writing floating-point fields Robert Dubner
2026-11-12  9:48   ` Rohr, Stephan
2026-11-12 17:05     ` Robert Dubner

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=20261111174247.3382098-1-rdubner@symas.com \
    --to=rdubner@symas.com \
    --cc=gdb-patches@sourceware.org \
    --cc=stephan.rohr@intel.com \
    /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