[PATCH] D60444: Make int type consistent for ASM labels

Brandon Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 02:29:56 PDT 2019


BrandonTJones created this revision.
BrandonTJones added reviewers: andreadb, grosbach.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Within the ASM parser, the label begins as a 64 byte long int and later gets treated as a 32 byte which can lead to crashes.


Repository:
  rL LLVM

https://reviews.llvm.org/D60444

Files:
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/test/MC/AsmParser/label_errors.s


Index: llvm/test/MC/AsmParser/label_errors.s
===================================================================
--- /dev/null
+++ llvm/test/MC/AsmParser/label_errors.s
@@ -0,0 +1,5 @@
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 > /dev/null| FileCheck %s --check-prefix=CHECK-ERROR
+
+
+# CHECK-ERROR: error: unexpected token at start of statement
+0777777777777777: foo
Index: llvm/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmParser.cpp
+++ llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1666,7 +1666,7 @@
   AsmToken ID = getTok();
   SMLoc IDLoc = ID.getLoc();
   StringRef IDVal;
-  int64_t LocalLabelVal = -1;
+  int32_t LocalLabelVal = -1;
   if (Lexer.is(AsmToken::HashDirective))
     return parseCppHashLineFilenameComment(IDLoc);
   // Allow an integer followed by a ':' as a directional local label.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60444.194269.patch
Type: text/x-patch
Size: 898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190409/952e9234/attachment.bin>


More information about the llvm-commits mailing list