From: Robert Dubner <rdubner@symas.com>
To: gdb-patches@sourceware.org
Cc: stephan.rohr@intel.com
Subject: [PATCH 0/2] gdb: Preserve signed zero in conversions and unary negation
Date: Wed, 11 Nov 2026 00:04:10 -0500 [thread overview]
Message-ID: <20261111050412.3340227-1-rdubner@symas.com> (raw)
This series fixes two places where GDB loses the sign of floating-point
zero.
The first patch preserves signed zero in the MPFR target encoder.
The encoder currently returns for zero before examining its sign.
Process the sign first, using mpfr_signbit, while retaining the existing
zero encoding for formats without signed-zero support.
The second patch corrects floating-point unary negation. Computing
zero minus the operand does not negate positive zero. Multiply
floating-point operands by -1 instead, leaving the integer and
fixed-point paths unchanged.
Together, these changes preserve the distinction between assigning
integer -0, which produces positive zero, and assigning floating-point
-0. or -.0, which produces negative zero.
adds DejaGNU coverage for literal types, assignments, both zero signs,
nested negation, and integer controls.
Robert Dubner (2):
gdb: Preserve signed zero in MPFR target conversions
gdb: Preserve signed zero in floating-point unary negation
gdb/target-float.c | 138 ++++++++++++++++++++++++++-
gdb/testsuite/gdb.base/float-neg.c | 30 ++++++
gdb/testsuite/gdb.base/float-neg.exp | 73 ++++++++++++++
gdb/valarith.c | 8 +-
4 files changed, 243 insertions(+), 6 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
next reply other threads:[~2026-11-11 5:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 5:04 Robert Dubner [this message]
2026-11-11 5:04 ` [PATCH 1/2] gdb: Preserve signed zero in MPFR target conversions Robert Dubner
2026-11-11 13:52 ` Rohr, Stephan
2026-11-11 5:04 ` [PATCH 2/2] gdb: Preserve signed zero in floating-point unary negation Robert Dubner
2026-11-11 13:50 ` Rohr, Stephan
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=20261111050412.3340227-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