[PATCH 1/2] gas/z80: adjust .assume handling

Jan Beulich jbeulich@suse.com
Fri Feb 13 14:55:28 GMT 2026


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.

--- 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 mailing list