Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] gdb: Floating-point assignment corner cases.
@ 2026-10-28 16:06 Robert Dubner
  2026-10-28 16:36 ` Robert Dubner
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Dubner @ 2026-10-28 16:06 UTC (permalink / raw)
  To: gdb-patches

To: gdb-patches@sourceware.org
Subject: [PATCH 0/4] gdb: Floating-point assignment corner cases.

While using OpenAI's Codex to develop test cases for the COBOL
extensions to GDB, a series of flaws in the code of gdb/target-float.c
were exposed.  This message explains the problems in broad; the four
additional messages contain patches to fix them.

The discussions of testing refer to my local repository, which contains
tests pertaining to COBOL that don't appear in the GDB repository.  I
include those descriptions here to provide some assurance that the
patches here have been tested.

This is my first attempt to contribute to GDB, and so I assume the form
of these patches isn't correct.  Please let me know what I can do
better; I will endeavor not to have to be corrected more than twice.
(I can't guarantee that just once will work, but I will try.)

The FSF has on file my releases, both from me as an individual and from
my employer, to provide contributions to GDB.

Given this program:

~~~~~~~~~~

double negative_zero = -0.0;
__float128 quad;
__float128 tiny = 0x1p-16494Q;
__float128 above_half = 0x1.00000000000000000001p-25Q;
_Float16 half;

int
main (void)
{
  return 0;
}

~~~~~~~~~~~

The patch repairs gdb assignments as follows:

print quad=negative_zero currently results in 0.  After the patch, it
shows -0.

print tiny * 1 results in 0.  After the patch, the result is
the subnormal 6.47517511943802511092443895822764655e-4966

print half = above_half results in 0. After the patch, the result is
5.9605e-08

print print half = -1 results in 1.  After the patch, it's -1.


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

end of thread, other threads:[~2026-10-28 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 16:06 [PATCH 0/4] gdb: Floating-point assignment corner cases Robert Dubner
2026-10-28 16:36 ` Robert Dubner
2026-10-28 21:30   ` Tom Tromey

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