Remove unneeded checks on type lengths.
authorJohn Baldwin <jhb@FreeBSD.org>
Sat, 11 Jun 2016 20:10:48 +0000 (13:10 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 14 Jun 2016 18:50:58 +0000 (11:50 -0700)
Type lengths are unsigned, so they are always greater than or equal to
zero.  A check against the length of 'tgt_type' is retained to prevent
dividing by zero.

gdb/ChangeLog:

* v850-tdep.c (v850_use_struct_convention): Trim type length checks.

gdb/ChangeLog
gdb/v850-tdep.c

index f2db9e9662e0e845ea30c9ca72b50a2c9e75333a..9e57431cc5210dfcbf5d51f809a587c856c9245c 100644 (file)
@@ -1,3 +1,7 @@
+2016-06-14  John Baldwin  <jhb@FreeBSD.org>
+
+       * v850-tdep.c (v850_use_struct_convention): Trim type length checks.
+
 2016-06-14  John Baldwin  <jhb@FreeBSD.org>
 
        * tui/tui-stack.c (tui_show_frame_info): Fix type mismatch.
index 612eec33fa87bff5417cb1755c9d615230ff6db0..0b50580f7c2479ab44ab4c13ec353e844b118f6a 100644 (file)
@@ -559,7 +559,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
          if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
            {
              tgt_type = TYPE_TARGET_TYPE (fld_type);
-             if (TYPE_LENGTH (fld_type) >= 0 && TYPE_LENGTH (tgt_type) >= 0
+             if (TYPE_LENGTH (tgt_type) > 0
                  && TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
                return 1;
            }