]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/config/tc-aarch64.c
aarch64: Try to avoid inappropriate default errors
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:06 +0000 (11:09 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:06 +0000 (11:09 +0100)
commit405f0c4131cbdf540d9e9559ba5d6e4f445a3818
tree1f60d65b54504e98306dd77b6fc754c547471ecb
parentb9ca389690810dd03e96a6d11470539f923d03b9
aarch64: Try to avoid inappropriate default errors

After parsing a '{' and the first register, parse_typed_reg would
report errors in subsequent registers in the same way as for the
first register.  It used set_default_error, which reports errors
of the form "operand N must be X".

The problem is that if there are multiple opcode entries for the
same mnemonic, there could be several matches that lead to a
default error.  There's no guarantee that the default error for
the register list is the one that will be chosen.

To take an example from the testsuite:

    ext z0.b,{z31.b,z32.b},#0

gave:

    operand 2 must be an SVE vector register

with the error being reported against the single-vector version
of ext, even though the operand is clearly a list.

This patch uses set_fatal_syntax_error to bump the priority of the
error once we're sure that the operand is a list of the right type.
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/illegal-sve2.l
gas/testsuite/gas/aarch64/sme-4-illegal.l
gas/testsuite/gas/aarch64/sme-4-illegal.s
gas/testsuite/gas/aarch64/sve-invalid.l
gas/testsuite/gas/aarch64/sve-invalid.s