aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/config/tc-i386-intel.c7
-rw-r--r--gas/config/tc-i386.c5
-rw-r--r--gas/testsuite/gas/i386/equ-2.l17
-rw-r--r--gas/testsuite/gas/i386/equ-2.s11
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
5 files changed, 39 insertions, 2 deletions
diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c
index 42f0afe..d0c30dd 100644
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -289,6 +289,13 @@ i386_intel_simplify_register (expressionS *e)
return 0;
}
+ if (!check_register (&i386_regtab[reg_num]))
+ {
+ as_bad (_("register '%s%s' cannot be used here"),
+ register_prefix, i386_regtab[reg_num].reg_name);
+ return 0;
+ }
+
if (!intel_state.in_bracket)
{
if (i.op[this_operand].regs)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index afb8b70..aea19aa 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -13000,11 +13000,12 @@ parse_register (char *reg_string, char **end_op)
int
i386_parse_name (char *name, expressionS *e, char *nextcharP)
{
- const reg_entry *r;
+ const reg_entry *r = NULL;
char *end = input_line_pointer;
*end = *nextcharP;
- r = parse_register (name, &input_line_pointer);
+ if (*name == REGISTER_PREFIX || allow_naked_reg)
+ r = parse_real_register (name, &input_line_pointer);
if (r && end <= input_line_pointer)
{
*nextcharP = *input_line_pointer;
diff --git a/gas/testsuite/gas/i386/equ-2.l b/gas/testsuite/gas/i386/equ-2.l
new file mode 100644
index 0000000..97a24b5
--- /dev/null
+++ b/gas/testsuite/gas/i386/equ-2.l
@@ -0,0 +1,17 @@
+.*: Assembler messages:
+.*:8: Error: .*
+#...
+GAS LISTING .*
+
+
+[ ]*[0-9]+[ ]+# .*
+[ ]*[0-9]+[ ]+equ:
+[ ]*[0-9]+[ ]+s = %edx % %ecx
+[ ]*[0-9]+[ ]+x = s
+[ ]*[0-9]+[ ]+y = s
+[ ]*[0-9]+[ ]+z = s
+[ ]*[0-9]+[ ]*
+[ ]*[0-9]+[ ]+t = %ymm5%%%!%%%%!%%%%%%%%!%ebp%%%%%%%%%%%%%%%%%%M
+[ ]*[0-9]+[ ]+a = t
+[ ]*[0-9]+[ ]+b = t
+[ ]*[0-9]+[ ]+c = t
diff --git a/gas/testsuite/gas/i386/equ-2.s b/gas/testsuite/gas/i386/equ-2.s
new file mode 100644
index 0000000..87ec9a7
--- /dev/null
+++ b/gas/testsuite/gas/i386/equ-2.s
@@ -0,0 +1,11 @@
+# PR gas/28977
+equ:
+ s = %edx % %ecx
+ x = s
+ y = s
+ z = s
+
+ t = %ymm5%%%!%%%%!%%%%%%%%!%ebp%%%%%%%%%%%%%%%%%%M
+ a = t
+ b = t
+ c = t
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 3c157e9..96356d3 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -99,6 +99,7 @@ if [gas_32_check] then {
run_list_test "suffix-bad"
run_dump_test "immed32"
run_dump_test "equ"
+ run_list_test "equ-2" "-al"
run_list_test "equ-bad"
run_dump_test "divide"
run_dump_test "quoted"