]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Correct the parsing of derferred register addressing in the PDP11 assembler.
authorJames Patrick Conlon <cptjustice@gmail.com>
Tue, 7 Aug 2018 07:34:08 +0000 (08:34 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 7 Aug 2018 07:34:08 +0000 (08:34 +0100)
PR 23481
* config/tc-pdp11.c (parse_op_noreg): Check for deferred register
addressing before assuming non-deferred addressing.
* testsuite/gas/pdp11/pr23481.s: New test source file.
* testsuite/gas/pdp11/pr23481.d: New test driver file.
* testsuite/gas/pdp11/pdp11.exp: Run the new test.

gas/ChangeLog
gas/config/tc-pdp11.c
gas/testsuite/gas/pdp11/pdp11.exp
gas/testsuite/gas/pdp11/pr23481.d [new file with mode: 0644]
gas/testsuite/gas/pdp11/pr23481.s [new file with mode: 0644]

index 4467bb2fb8b78635cec51d935f6914d7d32d4f3c..7874132d7f898506cbde20c749d70f353d569173 100644 (file)
@@ -1,3 +1,13 @@
+2018-08-07  James Patrick Conlon  <cptjustice@gmail.com>
+           Nick Clifton  <nickc@redhat.com>
+
+       PR 23481
+       * config/tc-pdp11.c (parse_op_noreg): Check for deferred register
+       addressing before assuming non-deferred addressing.
+       * testsuite/gas/pdp11/pr23481.s: New test source file.
+       * testsuite/gas/pdp11/pr23481.d: New test driver file.
+       * testsuite/gas/pdp11/pdp11.exp: Run the new test.
+
 2018-08-06  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/tc-arc.c (rf16_only): New static variable.
        (swap_2_operands): Also swap flags fields.
        * config/tc-i386-intel.c (i386_intel_operand): Likewise.
 
-2018-08-01  James Patrick Conlon <cptjustice@gmail.com>
+2018-08-01  James Patrick Conlon  <cptjustice@gmail.com>
            Nick Clifton  <nickc@redhat.com>
 
        PR 14480
index e151b274f6c5c8e3fc0b4d7b18c482baad5751a7..1ebd461d2655c4d382a9b615c6fa57c9e1d5b83b 100644 (file)
@@ -350,10 +350,7 @@ parse_reg (char *str, struct pdp11_code *operand)
       str += 2;
     }
   else
-    {
-      operand->error = _("Bad register name");
-      return str;
-    }
+    operand->error = _("Bad register name");
 
   return str;
 }
@@ -594,10 +591,21 @@ parse_op_noreg (char *str, struct pdp11_code *operand)
           str = parse_op_no_deferred (str, operand);
         }
       else
-        str = parse_op_no_deferred (str + 1, operand);
+        {
+          /* @Rn == (Rn): Register deferred.  */
+          str = parse_reg (str + 1, operand);
+         
+          /* Not @Rn */
+          if (operand->error)
+           {
+             operand->error = NULL;
+             str = parse_op_no_deferred (str, operand);
+           }
+        }
 
       if (operand->error)
        return str;
+
       operand->code |= 010;
     }
   else
index b3609f9ba06efe6129dd93178cb74dfca23ea4b2..0c785666d14ae2eec8196562331b2f52bfea77c7 100644 (file)
@@ -22,4 +22,5 @@ if [expr [istarget "pdp11-*-*"]]  then {
     run_dump_test "opcode"
     run_dump_test "absreloc"
     run_dump_test "pr14480"
+    run_dump_test "pr23481"
 }
diff --git a/gas/testsuite/gas/pdp11/pr23481.d b/gas/testsuite/gas/pdp11/pr23481.d
new file mode 100644 (file)
index 0000000..fb40785
--- /dev/null
@@ -0,0 +1,14 @@
+#name: PR 23481 - correct assembly of '@rN' and '(rN)'
+#objdump: -dw
+
+dump.o: +file format .*
+
+Disassembly of section .text:
+
+0+00 <start>:
+[      ]+0:[   ]+2009[         ]+cmp[  ]+r0, \(r1\)
+[      ]+2:[   ]+2009[         ]+cmp[  ]+r0, \(r1\)
+[      ]+4:[   ]+2240[         ]+cmp[  ]+\(r1\), r0
+[      ]+6:[   ]+2240[         ]+cmp[  ]+\(r1\), r0
+[      ]+8:[   ]+2249[         ]+cmp[  ]+\(r1\), \(r1\)
+#pass
diff --git a/gas/testsuite/gas/pdp11/pr23481.s b/gas/testsuite/gas/pdp11/pr23481.s
new file mode 100644 (file)
index 0000000..5a61b98
--- /dev/null
@@ -0,0 +1,10 @@
+start:
+        cmp     r0,(r1)
+        cmp     r0,@r1
+        cmp     (r1),r0
+        cmp     @r1,r0
+        cmp     (r1),@r1
+
+        halt
+
+        .END