Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] gdb: Preserve signed zero in conversions and unary negation
@ 2026-11-11  5:04 Robert Dubner
  2026-11-11  5:04 ` [PATCH 1/2] gdb: Preserve signed zero in MPFR target conversions Robert Dubner
  2026-11-11  5:04 ` [PATCH 2/2] gdb: Preserve signed zero in floating-point unary negation Robert Dubner
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Dubner @ 2026-11-11  5:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: stephan.rohr

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-11 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  5:04 [PATCH 0/2] gdb: Preserve signed zero in conversions and unary negation Robert Dubner
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox