[llvm] r217397 - Don't static_cast invalid pointers
    Hal Finkel 
    hfinkel at anl.gov
       
    Mon Sep  8 12:31:25 PDT 2014
    
    
  
Author: hfinkel
Date: Mon Sep  8 14:31:25 2014
New Revision: 217397
URL: http://llvm.org/viewvc/llvm-project?rev=217397&view=rev
Log:
Don't static_cast invalid pointers
UBSan complained about using static_cast on the invalid (tombstone, etc.)
pointers used by DenseMap. Use a reinterpret_cast instead.
Modified:
    llvm/trunk/include/llvm/Analysis/AssumptionTracker.h
Modified: llvm/trunk/include/llvm/Analysis/AssumptionTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AssumptionTracker.h?rev=217397&r1=217396&r2=217397&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AssumptionTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AssumptionTracker.h Mon Sep  8 14:31:25 2014
@@ -66,7 +66,7 @@ class AssumptionTracker : public Immutab
       operator CallInst*() const {
         Value *V = getValPtr();
         if (V == DMI::getEmptyKey() || V == DMI::getTombstoneKey())
-          return static_cast<CallInst*>(V);
+          return reinterpret_cast<CallInst*>(V);
 
         return cast<CallInst>(V);
       }
    
    
More information about the llvm-commits
mailing list