Ver Fonte

Fixed error in assertion in CommitBuffer

Richard Cobbe há 8 anos atrás
pai
commit
aedc4bce93
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      lib/Backend/EmitBuffer.cpp

+ 3 - 1
lib/Backend/EmitBuffer.cpp

@@ -483,7 +483,9 @@ EmitBufferManager<TAlloc, TPreReservedAlloc, SyncObject>::CommitBuffer(TEmitBuff
             AssertMsg(alignPad == 0, "If we are copying right now - we should be done with setting alignment.");
 
             const DWORD bufferBytesFree(allocation->BytesFree());
-            AnalysisAssert(currentDestBuffer + bufferBytesFree < destBuffer + destBufferBytes);
+            // Use <= here instead of < to allow this memcopy to fill up the rest of destBuffer.  If we do, then FinalizeAllocation,
+            // called below, determines that no additional padding is necessary based on the values in `allocation'.
+            AnalysisAssert(currentDestBuffer + bufferBytesFree <= destBuffer + destBufferBytes);
             memcpy_s(currentDestBuffer, bufferBytesFree, sourceBuffer, bytesToChange);
 
             currentDestBuffer += bytesToChange;