[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:26:51 PDT 2023


jacobly updated this revision to Diff 516977.
jacobly marked an inline comment as done.
jacobly added a comment.

Fix typo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149212/new/

https://reviews.llvm.org/D149212

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


Index: llvm/test/MC/AsmParser/directive_fill.s
===================================================================
--- llvm/test/MC/AsmParser/directive_fill.s
+++ llvm/test/MC/AsmParser/directive_fill.s
@@ -35,7 +35,7 @@
 
 # CHECK: TEST6
 # CHECK: .fill 1, 8, 0x2
-# CHECK-WARNINGS: '.fill' directive with size greater than 8 has been truncated to 8
+# CHECK-WARNINGS: '.fill' directive with a size of '9' has been truncated to 8
 TEST6:
 	.fill 1, 9, 2
 
@@ -51,7 +51,7 @@
 TEST8:
 	.fill -1, 8, 1
 
-# CHECK-WARNINGS: '.fill' directive with negative size has no effect
+# CHECK-WARNINGS: '.fill' directive with a size of '-1' has no effect
 TEST9:
 	.fill 1, -1, 1
 
@@ -77,3 +77,6 @@
 TEST13:
 	.fill TEST11 - TEST12+i, 4, 0x12345678
 
+# CHECK-WARNINGS: '.fill' directive with a size of '0' has no effect
+TEST14:
+	.fill 1, 0
Index: llvm/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmParser.cpp
+++ llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3354,12 +3354,14 @@
   if (parseEOL())
     return true;
 
-  if (FillSize < 0) {
-    Warning(SizeLoc, "'.fill' directive with negative size has no effect");
+  if (FillSize <= 0) {
+    Warning(SizeLoc, "'.fill' directive with a size of '" + Twine(FillSize) +
+                         "' has no effect");
     return false;
   }
   if (FillSize > 8) {
-    Warning(SizeLoc, "'.fill' directive with size greater than 8 has been truncated to 8");
+    Warning(SizeLoc, "'.fill' directive with a size of '" + Twine(FillSize) +
+                         "' has been truncated to 8");
     FillSize = 8;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149212.516977.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/26ad685d/attachment.bin>


More information about the llvm-commits mailing list