[binutils-gdb] gas/z80: adjust .assume handling

Jan Beulich jbeulich@sourceware.org
Fri Feb 20 07:40:06 GMT 2026


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

commit 61f8836e28f6366990d5ff1c10f6eccecdbaf985
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Feb 20 08:35:41 2026 +0100

    gas/z80: adjust .assume handling
    
    get_single_number() is (bogusly) more similar to get_absolute_expression()
    than its name says. As (per documentation) an expression is wanted here,
    use the respective function, which then also adds at least a little bit of
    error checking.
    
    While there also deal with possible stray other stuff on the line, as
    appropriate.

Diff:
---
 gas/config/tc-z80.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index b693d5095cd..5c9fc2fa813 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -3270,27 +3270,29 @@ assume (int arg ATTRIBUTE_UNUSED)
 {
   char *name;
   char c;
-  int n;
 
   input_line_pointer = (char*)skip_space (input_line_pointer);
   c = get_symbol_name (& name);
   if (strncasecmp (name, "ADL", 4) != 0)
     {
       ill_op ();
+      ignore_rest_of_line ();
       return;
     }
 
   restore_line_pointer (c);
   input_line_pointer = (char*)skip_space (input_line_pointer);
-  if (*input_line_pointer++ != '=')
+  if (*input_line_pointer != '=')
     {
       error (_("assignment expected"));
+      ignore_rest_of_line ();
       return;
     }
-  input_line_pointer = (char*)skip_space (input_line_pointer);
-  n = get_single_number ();
+  ++input_line_pointer;
+
+  set_cpu_mode (!!get_absolute_expression ());
 
-  set_cpu_mode (n);
+  demand_empty_rest_of_line ();
 }
 
 static const char *


More information about the Binutils-cvs mailing list