summaryrefslogtreecommitdiff
path: root/gdb/rs6000-tdep.c
diff options
context:
space:
mode:
authorJerome Guitton <guitton@adacore.com>2004-04-23 16:21:34 +0000
committerJerome Guitton <guitton@adacore.com>2004-04-23 16:21:34 +0000
commitb16c1112625c4c0d54cc64ac110b75426e4a4dad (patch)
tree8eb9dc858379d0b349e9e9b55d5276dd5026556e /gdb/rs6000-tdep.c
parent5a177417d3172c54ba1b9fbd80ba319a15cebb17 (diff)
downloadgdb-b16c1112625c4c0d54cc64ac110b75426e4a4dad.tar.gz
* rs6000-tdep.c (rs6000_extract_return_value): When extracting a float,
use convert_typed_floating to get the appropriate format.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r--gdb/rs6000-tdep.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index c9ab3a8b0eb..721443eeeaf 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1412,22 +1412,15 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
{
- double dd;
- float ff;
/* floats and doubles are returned in fpr1. fpr's have a size of 8 bytes.
We need to truncate the return value into float size (4 byte) if
necessary. */
- if (TYPE_LENGTH (valtype) > 4) /* this is a double */
- memcpy (valbuf,
- &regbuf[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1)],
- TYPE_LENGTH (valtype));
- else
- { /* float */
- memcpy (&dd, &regbuf[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1)], 8);
- ff = (float) dd;
- memcpy (valbuf, &ff, sizeof (float));
- }
+ convert_typed_floating (&regbuf[DEPRECATED_REGISTER_BYTE
+ (FP0_REGNUM + 1)],
+ builtin_type_double,
+ valbuf,
+ valtype);
}
else if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
&& TYPE_LENGTH (valtype) == 16