[llvm] db817d1 - [InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4
    Alexandre Ganea via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed May  6 06:12:11 PDT 2020
    
    
  
Author: Alexandre Ganea
Date: 2020-05-06T09:12:00-04:00
New Revision: db817d15d121d9bd650c566920820332c08d25b0
URL: https://github.com/llvm/llvm-project/commit/db817d15d121d9bd650c566920820332c08d25b0
DIFF: https://github.com/llvm/llvm-project/commit/db817d15d121d9bd650c566920820332c08d25b0.diff
LOG: [InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4
Differential Revision: https://reviews.llvm.org/D79337
Added: 
    
Modified: 
    llvm/lib/ProfileData/InstrProfReader.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 089dfca07f08..16a69cb5457b 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -423,11 +423,11 @@ Error RawInstrProfReader<IntPtrT>::readRawCounts(
 
   // Check bounds. Note that the counter pointer embedded in the data record
   // may itself be corrupt.
-  if (NumCounters > MaxNumCounters)
+  if (MaxNumCounters < 0 || NumCounters > (uint32_t)MaxNumCounters)
     return error(instrprof_error::malformed);
   ptr
diff _t CounterOffset = getCounterOffset(CounterPtr);
   if (CounterOffset < 0 || CounterOffset > MaxNumCounters ||
-      (CounterOffset + NumCounters) > MaxNumCounters)
+      ((uint32_t)CounterOffset + NumCounters) > (uint32_t)MaxNumCounters)
     return error(instrprof_error::malformed);
 
   auto RawCounts = makeArrayRef(getCounter(CounterOffset), NumCounters);
        
    
    
More information about the llvm-commits
mailing list