[PATCH] D20768: [MC] Return early when .fill size is negative

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 01:18:38 PDT 2016

phosek created this revision.
phosek added a reviewer: rafael.
phosek added subscribers: rafael, phosek, llvm-commits.
phosek set the repository for this revision to rL LLVM.

Rather than invoking emitFill with negative size, which may trigger
an undefined behavior, return immediately after emitting the warning.




Index: lib/MC/MCParser/AsmParser.cpp
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -2801,7 +2801,7 @@
   if (FillSize < 0) {
     Warning(SizeLoc, "'.fill' directive with negative size has no effect");
-    NumValues = MCConstantExpr::create(0, getStreamer().getContext());
+    return false;
   if (FillSize > 8) {
     Warning(SizeLoc, "'.fill' directive with size greater than 8 has been truncated to 8");

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20768.58883.patch
Type: text/x-patch
Size: 509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160528/c19714ff/attachment.bin>

More information about the llvm-commits mailing list