On Fri, Nov 27, 2009 at 12:47 PM, Anders Carlsson <[email protected]> wrote: > --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Nov 27 14:47:55 2009 > @@ -413,9 +413,10 @@ > > // Get the function pointer (or index if this is a virtual function). > if (MD->isVirtual()) { > - int64_t Index = CGM.getVtableInfo().getMethodVtableIndex(MD); > + uint64_t Index = CGM.getVtableInfo().getMethodVtableIndex(MD); > > - Values[0] = llvm::ConstantInt::get(PtrDiffTy, Index + 1); > + // The pointer is 1 + the virtual table offset in bytes. > + Values[0] = llvm::ConstantInt::get(PtrDiffTy, (Index * 8) + 1); > } else { > llvm::Constant *FuncPtr = CGM.GetAddrOfFunction(MD);
The constant 8 looks suspicious here. Perhaps you're looking for something more like "LLVMPointerWidth/8"? -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
