* rs6000-tdep.c (rs6000_extract_return_value): When extracting a float,
authorJerome Guitton <guitton@adacore.com>
Fri, 23 Apr 2004 16:21:34 +0000 (16:21 +0000)
committerJerome Guitton <guitton@adacore.com>
Fri, 23 Apr 2004 16:21:34 +0000 (16:21 +0000)
use convert_typed_floating to get the appropriate format.

gdb/ChangeLog
gdb/rs6000-tdep.c

index 786b4fe914630bfe5270852ad9c94e918dd676a1..98f5e3b0548519bcb9e1a8f79c330a880cab9fab 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-23  Jerome Guitton  <guitton@gnat.fr>
+
+       * rs6000-tdep.c (rs6000_extract_return_value): When extracting a float,
+       use convert_typed_floating to get the appropriate format.
+
 2004-04-22  Randolph Chung  <tausq@debian.org>
 
        * hppa-tdep.h (find_unwind_entry, hppa_get_field, hppa_extract_5_load)
index c9ab3a8b0ebf7b44bd77b03c577a50a463b2142c..721443eeeaf9b03c2c00d2c762f981cc4a74b948 100644 (file)
@@ -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