Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Execution.cpp updated: 1.173 -> 1.174 --- Log message: Fix a bug in IntToPtr. Truncating to 64-bits only works if the integer is larger. Adjust so that it truncates to pointer width, only if necessary. --- Diffs of the changes: (+5 -1) Execution.cpp | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.173 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.174 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.173 Mon Mar 5 21:09:31 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Mar 5 21:41:50 2007 @@ -1058,7 +1058,11 @@ GenericValue Dest, Src = getOperandValue(SrcVal, SF); assert(isa<PointerType>(DstTy) && "Invalid PtrToInt instruction"); - Dest.PointerVal = (PointerTy) Src.IntVal.trunc(64).getZExtValue(); + uint32_t PtrSize = TD.getPointerSize(); + if (PtrSize != Src.IntVal.getBitWidth()) + Src.IntVal = Src.IntVal.trunc(PtrSize); + + Dest.PointerVal = (PointerTy) Src.IntVal.getZExtValue(); return Dest; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits