[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:25:01 PDT 2023
jacobly updated this revision to Diff 516976.
jacobly added a comment.
Improve warning messages.
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 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 size of '" + Twine(FillSize) +
+ "' has been truncated to 8");
FillSize = 8;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149212.516976.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/e00509e9/attachment.bin>
More information about the llvm-commits
mailing list