[PATCH] D15742: Fix infinite recursion in MCAsmStreamer::EmitValueImpl

Alexandru Guduleasa via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 04:09:59 PST 2015


alexandru.guduleasa created this revision.
alexandru.guduleasa added reviewers: llvm-commits, majnemer.

If a target can only emit 8-bits data, it will loop in EmitValueImpl since it will try to split a 32-bits data in 1 chunk of 32-bits.
Since we know that "Size" is not supported on the target, choose "EmissionSize" as the greatest power of 2, smaller than "Size".

http://reviews.llvm.org/D15742

Files:
  lib/MC/MCAsmStreamer.cpp

Index: lib/MC/MCAsmStreamer.cpp
===================================================================
--- lib/MC/MCAsmStreamer.cpp
+++ lib/MC/MCAsmStreamer.cpp
@@ -715,10 +715,8 @@
     for (unsigned Emitted = 0; Emitted != Size;) {
       unsigned Remaining = Size - Emitted;
       // The size of our partial emission must be a power of two less than
-      // eight.
-      unsigned EmissionSize = PowerOf2Floor(Remaining);
-      if (EmissionSize > 4)
-        EmissionSize = 4;
+      // Size.
+      unsigned EmissionSize = PowerOf2Floor(Size - 1);
       // Calculate the byte offset of our partial emission taking into account
       // the endianness of the target.
       unsigned ByteOffset =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15742.43521.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151223/c796c604/attachment-0001.bin>


More information about the llvm-commits mailing list