Correct an error message in the ARM assembler.
authorNick Clifton <nickc@redhat.com>
Fri, 26 Feb 2021 16:37:30 +0000 (16:37 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 26 Feb 2021 16:37:30 +0000 (16:37 +0000)
PR 27411
* config/tc-arm.c (do_t_add_sub): Correct error message.
* testsuite/gas/arm/pr27411.s: New test.
* testsuite/gas/arm/pr27411.d: New test driver.
* testsuite/gas/arm/pr27411.l: Expected error output for new test.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/gas/arm/pr27411.d [new file with mode: 0644]
gas/testsuite/gas/arm/pr27411.l [new file with mode: 0644]
gas/testsuite/gas/arm/pr27411.s [new file with mode: 0644]

index 8086006ca162ed2dd44fe2be5ea2730c05070024..8dd9a59d0729e96b7d7dd4582a2dd7afdece295e 100644 (file)
@@ -1,3 +1,11 @@
+2021-02-26  Nick Clifton  <nickc@redhat.com>
+
+       PR 27411
+       * config/tc-arm.c (do_t_add_sub): Correct error message.
+       * testsuite/gas/arm/pr27411.s: New test.
+       * testsuite/gas/arm/pr27411.d: New test driver.
+       * testsuite/gas/arm/pr27411.l: Expected error output for new test.
+
 2021-02-24  Alan Modra  <amodra@gmail.com>
 
        PR 23691
index d3bb56d7ba6d1841f45aa45e3d37cb64fd425a55..e35cdd5190106eb76c9276c8565b1bc1687e35d2 100644 (file)
@@ -11635,7 +11635,7 @@ do_t_add_sub (void)
                  }
                }
              else
-               constraint (inst.size_req == 2, BAD_HIREG);
+               constraint (inst.size_req == 2, _("cannot honor width suffix"));
            }
          if (inst.size_req == 4
              || (inst.size_req != 2 && !opcode))
diff --git a/gas/testsuite/gas/arm/pr27411.d b/gas/testsuite/gas/arm/pr27411.d
new file mode 100644 (file)
index 0000000..14dcf43
--- /dev/null
@@ -0,0 +1,2 @@
+# name: PR 27411: Invalid immediate constants produce wrong error message
+# error_output: pr27411.l
diff --git a/gas/testsuite/gas/arm/pr27411.l b/gas/testsuite/gas/arm/pr27411.l
new file mode 100644 (file)
index 0000000..7201aa3
--- /dev/null
@@ -0,0 +1,6 @@
+[^:]*: Assembler messages:
+[^:]*:6: Error: cannot honor width suffix -- `add.n r4,#8'
+[^:]*:9: Error: cannot honor width suffix -- `sub.n r4,#8'
+[^:]*:12: Error: cannot honor width suffix -- `lsl.n r4,#8'
+[^:]*:13: Error: cannot honor width suffix -- `lsl.n sp,#8'
+#pass
diff --git a/gas/testsuite/gas/arm/pr27411.s b/gas/testsuite/gas/arm/pr27411.s
new file mode 100644 (file)
index 0000000..0d1f25b
--- /dev/null
@@ -0,0 +1,14 @@
+       .syntax unified
+       .thumb
+       .align 2
+       .thumb_func
+f1:
+      add.n r4, #8
+      add.n sp, #8
+      add.w r4, #8
+      sub.n r4, #8
+      sub.n sp, #8
+      sub.w r4, #8
+      lsl.n r4, #8
+      lsl.n sp, #8
+      lsl.w r4, #8