This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Remove unneeded checks on type lengths.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4bf5402d913e9a5d17d9ffb8701dbd054e1d158c

commit 4bf5402d913e9a5d17d9ffb8701dbd054e1d158c
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Sat Jun 11 13:10:48 2016 -0700

    Remove unneeded checks on type lengths.
    
    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.

Diff:
---
 gdb/ChangeLog   | 4 ++++
 gdb/v850-tdep.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f2db9e9..9e57431 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 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.
 
 2016-06-14  John Baldwin  <jhb@FreeBSD.org>
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 612eec3..0b50580 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -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;
 	    }


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