mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-04 10:30:30 +00:00
[AArch64][AsmParser] Fix segfault on illegal fpimm.
Floating point immediate combining a negative sign and a hexadecimal number, e.g. #-0x0 caused the compiler to crash. Reviewers: rengolin, fhahn, samparker, SjoerdMeijer, javed.absar Reviewed By: javed.absar Differential Revision: https://reviews.llvm.org/D47483 llvm-svn: 333524
This commit is contained in:
parent
51f7d78f33
commit
df7e091147
@ -2283,9 +2283,9 @@ AArch64AsmParser::tryParseFPImm(OperandVector &Operands) {
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.is(AsmToken::Real) || Tok.is(AsmToken::Integer)) {
|
||||
int64_t Val;
|
||||
if (Tok.is(AsmToken::Integer) && !isNegative && Tok.getString().startswith("0x")) {
|
||||
if (Tok.is(AsmToken::Integer) && Tok.getString().startswith("0x")) {
|
||||
Val = Tok.getIntVal();
|
||||
if (Val > 255 || Val < 0) {
|
||||
if (Val > 255 || isNegative) {
|
||||
TokError("encoded floating point value out of range");
|
||||
return MatchOperand_ParseFail;
|
||||
}
|
||||
|
@ -279,10 +279,15 @@
|
||||
//----------------------------------------------------------------------
|
||||
// invalid vector type (2s, 4s, 2d)
|
||||
fmov v0.4h, #1.0
|
||||
// invalid immediate (negative hexadecimal encoding)
|
||||
fmov v0.4s, #-0x0
|
||||
|
||||
// CHECK:ERROR: error: invalid operand for instruction
|
||||
// CHECK:ERROR: fmov v0.4h, #1.0
|
||||
// CHECK:ERROR: ^
|
||||
// CHECK-ERROR: error: encoded floating point value out of range
|
||||
// CHECK-ERROR: fmov v0.4s, #-0x0
|
||||
// CHECK-ERROR: ^
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Vector Move - register
|
||||
|
Loading…
x
Reference in New Issue
Block a user