I think I might have found a bug in the exection engine’s ‘constants folding’.
Basically APInt’s parameters are the wrong way round.
Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :-
case Instruction::PtrToInt: {
GenericValue GV = getConstantValue(Op0);
uint32_t PtrWidth = TD->getPointerSizeInBits();
GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
return GV;
}
Aaron
Aaron Gray wrote:
I think I might have found a bug in the exection engine’s ‘constants folding’.
Basically APInt’s parameters are the wrong way round.
Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :-
case Instruction::PtrToInt: {
GenericValue GV = getConstantValue(Op0);
uint32_t PtrWidth = TD->getPointerSizeInBits();
GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
return GV;
}
Aaron
That looks to be the right order to me:
APInt(unsigned numBits, uint64_t val, bool isSigned=false)
John.
The code matches:
APInt(unsigned numBits, uint64_t val, bool isSigned = false)
which is correct.
-Chris
2009/7/25 John McCall <rjmccall@apple.com>
Aaron Gray wrote:
I think I might have found a bug in the exection engine’s ‘constants folding’.
Basically APInt’s parameters are the wrong way round.
Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :-
case Instruction::PtrToInt: {
GenericValue GV = getConstantValue(Op0);
uint32_t PtrWidth = TD->getPointerSizeInBits();
GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
return GV;
}
Aaron
That looks to be the right order to me:
APInt(unsigned numBits, uint64_t val, bool isSigned=false)
Ah I was reading the private version !
Whoopse !
Aaron