[binutils-gdb] z80: use signed char for relative offset

Alan Modra via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5cd25036ae9e52fa04ecf08585906783798d2d44

commit 5cd25036ae9e52fa04ecf08585906783798d2d44
Author: Alan Modra <[email protected]>
Date:   Sun Mar 8 22:44:23 2026 +1030

    z80: use signed char for relative offset
    
    A char is signed on some hosts, unsigned on others.
    
            * z80-dis.c (prt_e): Don't use plain char for offset.

Diff:
---
 opcodes/z80-dis.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c
index 0c0c19092a2..d5b4c4210d0 100644
--- a/opcodes/z80-dis.c
+++ b/opcodes/z80-dis.c
@@ -111,13 +111,10 @@ prt (struct buffer *buf, disassemble_info * info, const char *txt)
 static int
 prt_e (struct buffer *buf, disassemble_info * info, const char *txt)
 {
-  char e;
-  int target_addr;
-
   if (fetch_data (buf, info, 1))
     {
-      e = buf->data[1];
-      target_addr = (buf->base + 2 + e) & 0xffff;
+      signed char e = buf->data[1];
+      int target_addr = (buf->base + 2 + e) & 0xffff;
       buf->n_used = buf->n_fetch;
       info->fprintf_func (info->stream, "%s0x%04x", txt, target_addr);
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.