[tsan] fix compile-time falilure found while building Chromium with tsan (tsan issue...
authorKostya Serebryany <kcc@google.com>
Thu, 5 Jul 2012 09:07:31 +0000 (09:07 +0000)
committerKostya Serebryany <kcc@google.com>
Thu, 5 Jul 2012 09:07:31 +0000 (09:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159736 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/ThreadSanitizer.cpp

index 4c12a9b624c95fa7bdf3b52c1c09f95d576c627d..dc0fa7175d98fb266be50894c9434f6ec6950c8b 100644 (file)
@@ -319,7 +319,12 @@ bool ThreadSanitizer::instrumentLoadOrStore(Instruction *I) {
   if (Idx < 0)
     return false;
   if (IsWrite && isVtableAccess(I)) {
+    DEBUG(dbgs() << "  VPTR : " << *I << "\n");
     Value *StoredValue = cast<StoreInst>(I)->getValueOperand();
+    // StoredValue does not necessary have a pointer type.
+    if (isa<IntegerType>(StoredValue->getType()))
+      StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy());
+    // Call TsanVptrUpdate.
     IRB.CreateCall2(TsanVptrUpdate,
                     IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
                     IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy()));