[PATCH] D47483: [AArch64][AsmParser] Fix segfault on illegal fpimm.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 02:58:37 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333524: [AArch64][AsmParser] Fix segfault on illegal fpimm. (authored by s.desmalen, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47483?vs=148920&id=149072#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47483

Files:
  llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/trunk/test/MC/AArch64/neon-diagnostics.s


Index: llvm/trunk/test/MC/AArch64/neon-diagnostics.s
===================================================================
--- llvm/trunk/test/MC/AArch64/neon-diagnostics.s
+++ llvm/trunk/test/MC/AArch64/neon-diagnostics.s
@@ -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
Index: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -2283,9 +2283,9 @@
   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;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47483.149072.patch
Type: text/x-patch
Size: 1653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/da6d93f3/attachment.bin>


More information about the llvm-commits mailing list