Don't static_cast invalid pointers
authorHal Finkel <hfinkel@anl.gov>
Mon, 8 Sep 2014 19:31:25 +0000 (19:31 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 8 Sep 2014 19:31:25 +0000 (19:31 +0000)
UBSan complained about using static_cast on the invalid (tombstone, etc.)
pointers used by DenseMap. Use a reinterpret_cast instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217397 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/AssumptionTracker.h

index 5e09b0ac6543eed165d2ee40aaf3505d2b495641..80ae513f4f93831f014a2887422f592ea35ff03f 100644 (file)
@@ -66,7 +66,7 @@ class AssumptionTracker : public ImmutablePass {
       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);
       }