[PATCH] D149212: [MCParser] Add warning for zero-size .fill

Jacob Young via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 16:03:00 PDT 2023


jacobly created this revision.
jacobly added a reviewer: grosbach.
jacobly added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
jacobly requested review of this revision.
Herald added a subscriber: llvm-commits.

Adding an early return avoids this assertion:

  llvm-mc: llvm/lib/MC/MCStreamer.cpp:135: virtual void llvm::MCStreamer::emitIntValue(uint64_t, unsigned int): Assertion `1 <= Size && Size <= 8 && "Invalid size"' failed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149212

Files:
  llvm/lib/MC/MCParser/AsmParser.cpp


Index: llvm/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmParser.cpp
+++ llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3354,6 +3354,10 @@
   if (parseEOL())
     return true;
 
+  if (FillSize == 0) {
+    Warning(SizeLoc, "'.fill' directive with 0 size has no effect");
+    return false;
+  }
   if (FillSize < 0) {
     Warning(SizeLoc, "'.fill' directive with negative size has no effect");
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149212.516964.patch
Type: text/x-patch
Size: 487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/9377ed67/attachment-0001.bin>


More information about the llvm-commits mailing list