From 94342ec38bc47cba884a975e37c74f20b598ca25 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 13 Jun 2011 09:57:35 +0000 Subject: [PATCH] PR gas/12854 * gas/arm/shift-bad.s: New test. * gas/arm/shift-bad.l: Expcted error output. * gas/arm/shift-bad.s: New control file. * config/tc-arm.c (do_shift): Do not allow shift operations at the end of a register based shift insn. (do_t_shift): Likewise. --- gas/ChangeLog | 7 +++++++ gas/config/tc-arm.c | 7 +++++++ gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/arm/shift-bad.d | 3 +++ gas/testsuite/gas/arm/shift-bad.l | 6 ++++++ gas/testsuite/gas/arm/shift-bad.s | 10 ++++++++++ 6 files changed, 40 insertions(+) create mode 100644 gas/testsuite/gas/arm/shift-bad.d create mode 100644 gas/testsuite/gas/arm/shift-bad.l create mode 100644 gas/testsuite/gas/arm/shift-bad.s diff --git a/gas/ChangeLog b/gas/ChangeLog index d265730b024..90c585fce90 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2011-06-13 Nick Clifton + + PR gas/12854 + * config/tc-arm.c (do_shift): Do not allow shift operations at the + end of a register based shift insn. + (do_t_shift): Likewise. + 2011-06-13 Nick Clifton * config/tc-score.c (s3_my_get_expression): Delete unused local diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index d4262a9e3a7..a34dceca5db 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -8343,6 +8343,9 @@ do_shift (void) { inst.instruction |= inst.operands[2].reg << 8; inst.instruction |= SHIFT_BY_REG; + /* PR 12854: Error on extraneous shifts. */ + constraint (inst.operands[2].shifted, + _("extraneous shift as part of operand to shift insn")); } else inst.reloc.type = BFD_RELOC_ARM_SHIFT_IMM; @@ -11535,6 +11538,10 @@ do_t_shift (void) inst.instruction |= inst.operands[0].reg << 8; inst.instruction |= inst.operands[1].reg << 16; inst.instruction |= inst.operands[2].reg; + + /* PR 12854: Error on extraneous shifts. */ + constraint (inst.operands[2].shifted, + _("extraneous shift as part of operand to shift insn")); } else { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index db2ff768e6e..8932f9a1505 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-06-13 Nick Clifton + + PR gas/12854 + * gas/arm/shift-bad.s: New test. + * gas/arm/shift-bad.l: Expcted error output. + * gas/arm/shift-bad.s: New control file. + 2011-06-12 H.J. Lu * gas/i386/arch-10-lzcnt.d: Updated. diff --git a/gas/testsuite/gas/arm/shift-bad.d b/gas/testsuite/gas/arm/shift-bad.d new file mode 100644 index 00000000000..7d4cac1979f --- /dev/null +++ b/gas/testsuite/gas/arm/shift-bad.d @@ -0,0 +1,3 @@ +# name: PR 12854: Extraneous shifts +# as: +# error-output: shift-bad.l diff --git a/gas/testsuite/gas/arm/shift-bad.l b/gas/testsuite/gas/arm/shift-bad.l new file mode 100644 index 00000000000..6db9583cd7e --- /dev/null +++ b/gas/testsuite/gas/arm/shift-bad.l @@ -0,0 +1,6 @@ +.*shift-bad.s: Assembler messages: +.*shift-bad.s:3: Error: extraneous shift as part of operand to shift insn -- `asr r0,r1,r2,ror#5' +.*shift-bad.s:4: Error: extraneous shift as part of operand to shift insn -- `ror r0,r1,r2,lsl r3' +.*shift-bad.s:8: Error: extraneous shift as part of operand to shift insn -- `ror r0,r1,r2,lsl#1' +.*shift-bad.s:9: Error: extraneous shift as part of operand to shift insn -- `lsl r0,r1,r2,lsl#1' +.*shift-bad.s:10: Error: extraneous shift as part of operand to shift insn -- `lsl r0,r1,r2,asr r0' diff --git a/gas/testsuite/gas/arm/shift-bad.s b/gas/testsuite/gas/arm/shift-bad.s new file mode 100644 index 00000000000..6e6a795abf1 --- /dev/null +++ b/gas/testsuite/gas/arm/shift-bad.s @@ -0,0 +1,10 @@ + .syntax unified + + asr r0, r1, r2, ror #5 + ror r0, r1, r2, lsl r3 + + .thumb_func +foo: + ror r0, r1, r2, lsl #1 + lsl r0, r1, r2, lsl #1 + lsl r0, r1, r2, asr r0 -- 2.30.2