aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2000-03-20 22:15:58 +0000
committerKevin Buettner <kevinb@redhat.com>2000-03-20 22:15:58 +0000
commitba8966d6c3319a2d7ea06ec25ed7a15cc1be94d5 (patch)
tree7ea9eea851c0ccad2c7142a74a7d638f85240c87 /gdb
parente7ee86a99a02694c6bcac22f53b09680ad6c5f86 (diff)
downloadfsf-binutils-gdb-ba8966d6c3319a2d7ea06ec25ed7a15cc1be94d5.zip
fsf-binutils-gdb-ba8966d6c3319a2d7ea06ec25ed7a15cc1be94d5.tar.gz
fsf-binutils-gdb-ba8966d6c3319a2d7ea06ec25ed7a15cc1be94d5.tar.bz2
Fixes for floatformat_from_doublest().
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/utils.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b715b30..5aad81e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2000-03-20 Kevin Buettner <kevinb@redhat.com>
+
+ * utils.c (floatformat_from_doublest): Don't assume that a long
+ will be exactly 32 bits in length. Also... make sure space
+ that we're writing the float to is completely initialized to
+ zeroes, even when the number of bits in the float is not
+ evenly divisible by FLOATFORMAT_CHAR_BIT.
+
2000-03-20 Jim Blandy <jimb@redhat.com>
* i386-linux-nat.c: No need to #include "frame.h" any more.
diff --git a/gdb/utils.c b/gdb/utils.c
index a752f71..824dabe 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2722,7 +2722,8 @@ floatformat_from_doublest (fmt, from, to)
unsigned char *uto = (unsigned char *) to;
memcpy (&dfrom, from, sizeof (dfrom));
- memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
+ memset (uto, 0, (fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1)
+ / FLOATFORMAT_CHAR_BIT);
if (dfrom == 0)
return; /* Result is zero */
if (dfrom != dfrom) /* Result is NaN */
@@ -2771,7 +2772,7 @@ floatformat_from_doublest (fmt, from, to)
mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
mant *= 4294967296.0;
- mant_long = (unsigned long) mant;
+ mant_long = ((unsigned long) mant) & 0xffffffffL;
mant -= mant_long;
/* If the integer bit is implicit, then we need to discard it.
@@ -2782,6 +2783,7 @@ floatformat_from_doublest (fmt, from, to)
&& fmt->intbit == floatformat_intbit_no)
{
mant_long <<= 1;
+ mant_long &= 0xffffffffL;
mant_bits -= 1;
}