public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] RISC-V: Fix T-Head immediate types on printing
@ 2022-10-06  3:35 Tsukasa OI
  0 siblings, 0 replies; only message in thread
From: Tsukasa OI @ 2022-10-06  3:35 UTC (permalink / raw)
  To: bfd-cvs

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

commit 15543290129fde8b89b71f6e6494b88ca833c59c
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date:   Mon Sep 26 11:13:51 2022 +0000

    RISC-V: Fix T-Head immediate types on printing
    
    This commit fixes two minor typing-related issues for
    T-Head immediate operands.
    
    1.  A signed type must be specified when printing with %i.
    2.  unsigned/signed int is not portable enough for max 32-bit immediates.
        Instead, we should use unsigned/signed long.
        The format string is changed accordingly.
    
    opcodes/ChangeLog:
    
            * riscv-dis.c (print_insn_args): Fix T-Head immediate types on
            printing.

Diff:
---
 opcodes/riscv-dis.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 50e634ebfda..9d733565549 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -597,11 +597,11 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
 		  oparg--;
 
 		  if (!sign)
-		    print (info->stream, dis_style_immediate, "%u",
-			   (unsigned)EXTRACT_U_IMM (n, s, l));
+		    print (info->stream, dis_style_immediate, "%lu",
+			   (unsigned long)EXTRACT_U_IMM (n, s, l));
 		  else
-		    print (info->stream, dis_style_immediate, "%i",
-			   (unsigned)EXTRACT_S_IMM (n, s, l));
+		    print (info->stream, dis_style_immediate, "%li",
+			   (signed long)EXTRACT_S_IMM (n, s, l));
 		  break;
 		default:
 		  goto undefined_modifier;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-06  3:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  3:35 [binutils-gdb] RISC-V: Fix T-Head immediate types on printing Tsukasa OI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).