From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YzZVCQFD9GEwCwAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 14:24:49 -0500 Received: by simark.ca (Postfix, from userid 112) id 12F941F0E7; Fri, 28 Jan 2022 14:24:49 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 483BC1EDF0 for ; Fri, 28 Jan 2022 14:24:48 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19707382C401 for ; Fri, 28 Jan 2022 19:24:47 +0000 (GMT) Received: from mail.baldwin.cx (bigwig.baldwin.cx [66.216.25.90]) by sourceware.org (Postfix) with ESMTPS id 0BFC1385840C for ; Fri, 28 Jan 2022 19:24:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0BFC1385840C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 38C731A84C54 for ; Fri, 28 Jan 2022 14:24:36 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH] gdb: fix ppc-sysv-tdep.c build on 32-bit platforms Date: Fri, 28 Jan 2022 11:24:25 -0800 Message-Id: <20220128192425.76123-1-jhb@FreeBSD.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Fri, 28 Jan 2022 14:24:36 -0500 (EST) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The previous code triggered the following error on an i386 host: /git/gdb/gdb/ppc-sysv-tdep.c:1764:34: error: non-constant-expression cannot be narrowed from type 'ULONGEST' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] unscaled.read ({writebuf, TYPE_LENGTH (valtype)}, ^~~~~~~~~~~~~~~~~~~~~ /git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH' ^~~~~~~~~~~~~~~~~~ /git/gdb/gdb/ppc-sysv-tdep.c:1764:34: note: insert an explicit cast to silence this issue unscaled.read ({writebuf, TYPE_LENGTH (valtype)}, ^~~~~~~~~~~~~~~~~~~~~ static_cast( ) /git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH' ^~~~~~~~~~~~~~~~~~ 1 error generated. Fix this by using gdb::make_array_view. --- gdb/ppc-sysv-tdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 5255cea43e3..9a3b02f028d 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1761,7 +1761,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* Fixed point type values need to be returned unscaled. */ gdb_mpz unscaled; - unscaled.read ({writebuf, TYPE_LENGTH (valtype)}, + unscaled.read (gdb::make_array_view (writebuf, + TYPE_LENGTH (valtype)), type_byte_order (valtype), valtype->is_unsigned ()); return_val = unscaled.as_integer (); -- 2.34.1