From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id E8666384D197 for ; Sat, 9 Jul 2022 03:51:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8666384D197 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 34E0C300089; Sat, 9 Jul 2022 03:51:21 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH 2/2] RISC-V: Fix required bits on certain environments Date: Sat, 9 Jul 2022 12:50:58 +0900 Message-Id: <812ccac36d18defcff10975285f6f1233a411a96.1657338656.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2022 03:51:24 -0000 If `unsigned long long' type has more than 64-bits, validate_riscv_insn function generated wrong required_bits value. This commit fixes this small issue (may be too pedantic though). gas/ChangeLog: * config/tc-riscv.c (validate_riscv_insn): Compute correct required_bits value when unsigned long long is larger than 64b. --- gas/config/tc-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 8a961c05d95..9581a5c6e03 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -1110,7 +1110,7 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length) else insn_width = 8 * length; - required_bits = ~0ULL >> (64 - insn_width); + required_bits = ((insn_t)~0ULL) >> (64 - insn_width); if ((used_bits & opc->match) != (opc->match & required_bits)) { -- 2.34.1