aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-03-18 16:33:51 +1030
committerAlan Modra <amodra@gmail.com>2022-03-18 17:24:13 +1030
commit5fac3f02edacfca458f7eeaaaa33a87e26e0e332 (patch)
tree3513b94e4a4228a4fdde01e4deaf74b54b971519 /gas/config
parent9e2c3422948db83ec54ef54e53403cc4fb4c4190 (diff)
downloadgdb-5fac3f02edacfca458f7eeaaaa33a87e26e0e332.zip
gdb-5fac3f02edacfca458f7eeaaaa33a87e26e0e332.tar.gz
gdb-5fac3f02edacfca458f7eeaaaa33a87e26e0e332.tar.bz2
PR28977 tc-i386.c internal error in parse_register
PR 28977 * config/tc-i386.c (parse_register): Handle X_op not O_register as for a non-reg_section symbol. Simplify array bounds check.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 1cc14fe..8ef71b6 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -12952,17 +12952,18 @@ parse_register (char *reg_string, char **end_op)
{
const expressionS *e = symbol_get_value_expression (symbolP);
- know (e->X_op == O_register);
- know (e->X_add_number >= 0
- && (valueT) e->X_add_number < i386_regtab_size);
- r = i386_regtab + e->X_add_number;
- if (!check_register (r))
+ if (e->X_op == O_register
+ && (valueT) e->X_add_number < i386_regtab_size)
{
- as_bad (_("register '%s%s' cannot be used here"),
- register_prefix, r->reg_name);
- r = &bad_reg;
+ r = i386_regtab + e->X_add_number;
+ if (!check_register (r))
+ {
+ as_bad (_("register '%s%s' cannot be used here"),
+ register_prefix, r->reg_name);
+ r = &bad_reg;
+ }
+ *end_op = input_line_pointer;
}
- *end_op = input_line_pointer;
}
*input_line_pointer = c;
input_line_pointer = save;