From 99b2a2dd3cd91ee45aba56a90b52be943001e8f4 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 29 Apr 2015 17:09:05 +0100 Subject: Fix an internal error in GAS when assembling a bogus piece of source code. 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 | 6 ++++++ gas/config/tc-arm.c | 7 ++++++- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/arm/pr18256.d | 9 +++++++++ gas/testsuite/gas/arm/pr18256.l | 2 ++ gas/testsuite/gas/arm/pr18256.s | 1 + 6 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/arm/pr18256.d create mode 100644 gas/testsuite/gas/arm/pr18256.l create mode 100644 gas/testsuite/gas/arm/pr18256.s (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 1affd227fb6..9ba6648bd48 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2015-04-29 Nick Clifton + + 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 * doc/as.texinfo (Set): Note that a symbol cannot be set multiple diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 5ce4da53376..bc8f7758bc6 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -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; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index d0167bef8e0..aed518ab5ab 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-04-29 Nick Clifton + + 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 * 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 index 00000000000..0c5e514049c --- /dev/null +++ b/gas/testsuite/gas/arm/pr18256.d @@ -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 index 00000000000..b68e914f54e --- /dev/null +++ b/gas/testsuite/gas/arm/pr18256.l @@ -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 index 00000000000..3008d53e3d9 --- /dev/null +++ b/gas/testsuite/gas/arm/pr18256.s @@ -0,0 +1 @@ + LDC p0, c0, =. -- cgit v1.2.1