[LLVMdev] tiny compilation error with g++ 4.1.3

Basile STARYNKEVITCH basile at starynkevitch.net
Wed May 16 05:06:03 PDT 2007

Hello All

File llvm/lib/ExecutionEngine/Interpreter/Execution.cpp (cvs rev 1.182)
fails to compile with g++ 4.1.3 (Debian/Sid/AMD64 system)

make[2]: Leaving directory `/usr/src/Lang/llvm/_Obj64/lib/Target'
make[2]: Entering directory `/usr/src/Lang/llvm/_Obj64/lib/ExecutionEngine'
make[3]: Entering directory `/usr/src/Lang/llvm/_Obj64/lib/ExecutionEngine/Interpreter'
llvm[3]: Compiling Execution.cpp for Debug build
/usr/src/Lang/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp: In function 'void PrintGenericValue(const llvm::GenericValue&, const llvm::Type*)':
/usr/src/Lang/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1347: error: cast from 'void*' to 'unsigned int' loses precision

The trivial patch which works for me is to use intptr_t instead of unsigned, hence replacing the faulty line with

    case Type::PointerTyID: DOUT << "void* " << (intptr_t)(Val.PointerVal); break;

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

More information about the llvm-dev mailing list