This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][02/19] Target FP: Simplify floatformat_from_type


On 2017-09-05 20:20, Ulrich Weigand wrote:
Index: binutils-gdb/gdb/gdbtypes.c
===================================================================
--- binutils-gdb.orig/gdb/gdbtypes.c
+++ binutils-gdb/gdb/gdbtypes.c
@@ -2735,22 +2735,31 @@ set_type_code (struct type *type, enum t
    determined by the floatformat.  Returns size to be used.  */

 static int
-verify_floatformat (int bit, const struct floatformat **floatformats)
+verify_floatformat (int bit, const struct floatformat *floatformat)
 {
-  gdb_assert (floatformats != NULL);
-  gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
+  gdb_assert (floatformat != NULL);

   if (bit == -1)
-    bit = floatformats[0]->totalsize;
+    bit = floatformat->totalsize;
   gdb_assert (bit >= 0);

   size_t len = bit / TARGET_CHAR_BIT;
-  gdb_assert (len >= floatformat_totalsize_bytes (floatformats[0]));
-  gdb_assert (len >= floatformat_totalsize_bytes (floatformats[1]));
+  gdb_assert (len * TARGET_CHAR_BIT >= floatformat->totalsize);

That looks funny now.  Is there a reason not to do

  gdb_assert (bit >= floatformat->totalsize);

directly?

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]