public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <a4lg@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] RISC-V: Fix printf argument types corresponding %x
Date: Thu,  6 Oct 2022 03:35:08 +0000 (GMT)	[thread overview]
Message-ID: <20221006033508.7862B384D1BE@sourceware.org> (raw)

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

commit 2cfc7c876d57171dbe8a16e90218be9c1f6e1f19
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date:   Wed Jul 13 22:33:07 2022 +0900

    RISC-V: Fix printf argument types corresponding %x
    
    "%x" format specifier requires unsigned type, not int.  This commit
    fixes this issue on the RISC-V disassembler.
    
    opcodes/ChangeLog:
    
            * riscv-dis.c (print_insn_args): Fix printf argument types where
            the format specifier is "%x".

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

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 0070b2323c0..ae35790d43b 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -292,15 +292,15 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
 	      break;
 	    case 'u':
 	      print (info->stream, dis_style_immediate, "0x%x",
-		     (int)(EXTRACT_CITYPE_IMM (l) & (RISCV_BIGIMM_REACH-1)));
+		     (unsigned)(EXTRACT_CITYPE_IMM (l) & (RISCV_BIGIMM_REACH-1)));
 	      break;
 	    case '>':
 	      print (info->stream, dis_style_immediate, "0x%x",
-		     (int)EXTRACT_CITYPE_IMM (l) & 0x3f);
+		     (unsigned)EXTRACT_CITYPE_IMM (l) & 0x3f);
 	      break;
 	    case '<':
 	      print (info->stream, dis_style_immediate, "0x%x",
-		     (int)EXTRACT_CITYPE_IMM (l) & 0x1f);
+		     (unsigned)EXTRACT_CITYPE_IMM (l) & 0x1f);
 	      break;
 	    case 'T': /* Floating-point RS2.  */
 	      print (info->stream, dis_style_register, "%s",
@@ -481,7 +481,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
 
 	case 'y':
 	  print (info->stream, dis_style_immediate, "0x%x",
-		 (int)EXTRACT_OPERAND (BS, l));
+		 (unsigned)EXTRACT_OPERAND (BS, l));
 	  break;
 
 	case 'z':
@@ -490,12 +490,12 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
 
 	case '>':
 	  print (info->stream, dis_style_immediate, "0x%x",
-		 (int)EXTRACT_OPERAND (SHAMT, l));
+		 (unsigned)EXTRACT_OPERAND (SHAMT, l));
 	  break;
 
 	case '<':
 	  print (info->stream, dis_style_immediate, "0x%x",
-		 (int)EXTRACT_OPERAND (SHAMTW, l));
+		 (unsigned)EXTRACT_OPERAND (SHAMTW, l));
 	  break;
 
 	case 'S':
@@ -556,7 +556,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
 
 	case 'Y':
 	  print (info->stream, dis_style_immediate, "0x%x",
-		 (int) EXTRACT_OPERAND (RNUM, l));
+		 (unsigned) EXTRACT_OPERAND (RNUM, l));
 	  break;
 
 	case 'Z':

                 reply	other threads:[~2022-10-06  3:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221006033508.7862B384D1BE@sourceware.org \
    --to=a4lg@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).