Fix an internal error in GAS when assembling a bogus piece of source code.
authorNick Clifton <nickc@redhat.com>
Wed, 29 Apr 2015 16:09:05 +0000 (17:09 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 29 Apr 2015 16:09:05 +0000 (17:09 +0100)
gas PR 18256
* config/tc-arm.c (encode_arm_cp_address): Issue an error message
if the operand is neither a register nor a vector.

tests * gas/arm/pr18256.s: New file: Test case.
* gas/arm/pr18256.l: New file: Expected assembler output.
* gas/arm/pr18256.d: New file: Test driver.

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

index 1affd22..9ba6648 100644 (file)
@@ -1,5 +1,11 @@
 2015-04-29  Nick Clifton  <nickc@redhat.com>
 
+       PR 18256
+       * config/tc-arm.c (encode_arm_cp_address): Issue an error message
+       if the operand is neither a register nor a vector.
+
+2015-04-29  Nick Clifton  <nickc@redhat.com>
+
        * doc/as.texinfo (Set): Note that a symbol cannot be set multiple
        times if the expression is not constant and the target uses linker
        relaxation.
index 5ce4da5..bc8f775 100644 (file)
@@ -7891,7 +7891,12 @@ encode_arm_cp_address (int i, int wb_ok, int unind_ok, int reloc_override)
 {
   if (!inst.operands[i].isreg)
     {
-      gas_assert (inst.operands[0].isvec);
+      /* PR 18256 */
+      if (! inst.operands[0].isvec)
+       {
+         inst.error = _("invalid co-processor operand");
+         return FAIL;
+       }
       if (move_or_literal_pool (0, CONST_VEC, /*mode_3=*/FALSE))
        return SUCCESS;
     }
index d0167be..aed518a 100644 (file)
@@ -1,3 +1,10 @@
+2015-04-29  Nick Clifton  <nickc@redhat.com>
+
+       PR gas/18265
+       * gas/arm/pr18256.s: New file: Test case.
+       * gas/arm/pr18256.l: New file: Expected assembler output.
+       * gas/arm/pr18256.d: New file: Test driver.
+
 2015-04-28  Renlin Li  <renlin.li@arm.com>
 
        * gas/arm/thumb2_vpool_be.d: Adjust the desired output.
diff --git a/gas/testsuite/gas/arm/pr18256.d b/gas/testsuite/gas/arm/pr18256.d
new file mode 100644 (file)
index 0000000..0c5e514
--- /dev/null
@@ -0,0 +1,9 @@
+# name: PR18256 - Bad code triggers internal error
+#as:
+#error-output: pr18256.l
+
+
+
+
+
+
diff --git a/gas/testsuite/gas/arm/pr18256.l b/gas/testsuite/gas/arm/pr18256.l
new file mode 100644 (file)
index 0000000..b68e914
--- /dev/null
@@ -0,0 +1,2 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: invalid co-processor operand -- `ldc p0,c0,=.'
diff --git a/gas/testsuite/gas/arm/pr18256.s b/gas/testsuite/gas/arm/pr18256.s
new file mode 100644 (file)
index 0000000..3008d53
--- /dev/null
@@ -0,0 +1 @@
+   LDC p0, c0, =.