From patchwork Sat Jun 11 20:48:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 12988 Received: (qmail 103644 invoked by alias); 11 Jun 2016 20:49:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 103495 invoked by uid 89); 11 Jun 2016 20:49:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=2.7.0, 1, 9 X-Spam-User: qpsmtpd, 2 recipients X-HELO: bigwig.baldwin.cx Received: from bigwig.baldwin.cx (HELO bigwig.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 11 Jun 2016 20:49:31 +0000 Received: from ralph.baldwin.cx.net (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4A90DB9C7; Sat, 11 Jun 2016 16:49:28 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH 7/8] Remove unneeded checks on type lengths. Date: Sat, 11 Jun 2016 13:48:34 -0700 Message-Id: <1465678115-58170-8-git-send-email-jhb@FreeBSD.org> In-Reply-To: <1465678115-58170-1-git-send-email-jhb@FreeBSD.org> References: <1465678115-58170-1-git-send-email-jhb@FreeBSD.org> X-IsSubscribed: yes Type lengths are unsigned, so are always greater than zero. A check against the length of 'tgt_type' is retained to prevent dividing by zero. --- gdb/ChangeLog | 4 ++++ gdb/v850-tdep.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d188af9..4c4389d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2016-06-11 John Baldwin + * v850-tdep.c (v850_use_struct_convention): Trim type length checks. + +2016-06-11 John Baldwin + * tui/tui-stack.c (tui_show_frame_info): Fix type mismatch. 2016-06-11 John Baldwin 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; }