mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 12:02:58 +02:00
7ef9328e08
Current code does not check that a register number is in the 0-31 range. Sometimes the parser checks that later for some kinds of instructions, but that leads to unclear / incorrect error messages like that: % cat test.s .text lb $4, 8($32) % llvm-mc test.s -triple=mips64-unknown-linux test.s:2:10: error: expected memory with 16-bit signed offset lb $4, 8($32) ^ Sometimes the parser just crashes: % cat test.s .text lw $4, 8($32) % llvm-mc test.s -triple=mips64-unknown-linux This patch resolves the problem by checking that register number after '$' sign is in the 0-31 range. If the number is out of the range the parser shows the `invalid register number` error, but treats invalid register number as a normal one to continue parsing and catch other possible errors. Differential Revision: https://reviews.llvm.org/D45919 llvm-svn: 330732
11 lines
370 B
ArmAsm
11 lines
370 B
ArmAsm
# RUN: not llvm-mc %s -triple=mips-unknown-freebsd -show-encoding 2>%t0
|
|
# RUN: FileCheck %s < %t0
|
|
|
|
# $32 used to trigger an assertion instead of the usual error message due to
|
|
# an off-by-one bug.
|
|
|
|
# CHECK: :[[@LINE+1]]:17: error: invalid register number
|
|
add $32, $0, $0
|
|
# CHECK: :[[@LINE+1]]:26: error: invalid register number
|
|
lw $8, 0x10($32)
|