[compiler-rt] 6dfe8e5 - [profile] Second speculative fix for Windows

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 16:26:14 PDT 2019


Author: Vedant Kumar
Date: 2019-10-31T16:25:25-07:00
New Revision: 6dfe8e590e1e50e26c80af59971bc206d8c567f6

URL: https://github.com/llvm/llvm-project/commit/6dfe8e590e1e50e26c80af59971bc206d8c567f6
DIFF: https://github.com/llvm/llvm-project/commit/6dfe8e590e1e50e26c80af59971bc206d8c567f6.diff

LOG: [profile] Second speculative fix for Windows

VLAs in C appear to not work on Windows, so use COMPILER_RT_ALLOCA:

C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\profile\InstrProfilingWriter.c(264): error C2057: expected constant expression
C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\profile\InstrProfilingWriter.c(264): error C2466: cannot allocate an array of constant size 0
C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\profile\InstrProfilingWriter.c(264): error C2133: 'Zeroes': unknown size

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingWriter.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingWriter.c b/compiler-rt/lib/profile/InstrProfilingWriter.c
index ae9e1fa6ac13..0b2e17612ab3 100644
--- a/compiler-rt/lib/profile/InstrProfilingWriter.c
+++ b/compiler-rt/lib/profile/InstrProfilingWriter.c
@@ -261,7 +261,7 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
 
   /* Enough zeroes for padding. */
   unsigned PageSize = getpagesize();
-  char Zeroes[PageSize];
+  char *Zeroes = (char *)COMPILER_RT_ALLOCA(PageSize);
   memset(Zeroes, 0, PageSize);
 
   /* Create the header. */


        


More information about the llvm-commits mailing list