Bug 45905

Summary: error: cast from ‘void*’ to ‘intptr_t {aka int}’ loses precision [-fpermissive] in ast_to_hir.cpp
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Alexandre Demers 2012-02-10 09:15:58 UTC
g++ -c -I. -I../mesa -I../mapi -I../../include  -g -O2 -Wall -fno-strict-aliasing -fno-builtin-memcmp -m64  -fPIC  -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DMESA_SELINUX -DIN_DRI_DRIVER -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DHAVE_XEXTPROTO_71  -DFEATURE_GL=1 -DFEATURE_ES1=1 -DFEATURE_ES2=1 -fvisibility=hidden -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DMESA_SELINUX -DIN_DRI_DRIVER -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DHAVE_XEXTPROTO_71  -DFEATURE_GL=1 -DFEATURE_ES1=1 -DFEATURE_ES2=1 ast_to_hir.cpp -o ast_to_hir.o
In file included from ast_to_hir.cpp:57:0:
../mesa/program/hash_table.h: In member function ‘bool string_to_uint_map::get(unsigned int&, const char*)’:
../mesa/program/hash_table.h:238:58: error: cast from ‘void*’ to ‘intptr_t {aka int}’ loses precision [-fpermissive]
../mesa/program/hash_table.h: In member function ‘void string_to_uint_map::put(unsigned int, const char*)’:
../mesa/program/hash_table.h:262:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
ast_to_hir.cpp: In member function ‘virtual ir_rvalue* ast_case_label::hir(exec_list*, _mesa_glsl_parse_state*)’:
ast_to_hir.cpp:3721:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
ast_to_hir.cpp:3734:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
make[2]: *** [ast_to_hir.o] Error 1
Comment 1 Ian Romanick 2012-02-10 11:32:53 UTC
Something is wonkey with your build or your system.  The whole purpose of the intptr_t type is to be an integer that is large enough to hold a pointer.  It sounds like stdint.h on your system is broken or the compile is (somehow) picking up the wrong one.

You might try copy-and-pasting that compile line replacing the -c with -E.  The output may give some clue as to where the broken intptr_t definition is coming from.
Comment 2 Alexandre Demers 2012-02-10 19:56:36 UTC
Indeed, there seems  to be something wrong. My system doesn't boot anymore... I'm working on it and when that will be fixed, I'll tell you if my build goes back to a working state.
Comment 3 Alexandre Demers 2012-02-10 20:26:47 UTC
Ok, my system is mostly fixed (Xorg crashes when starting, pointing maybe to libc and/or the ddx driver).

So I tried replacing -c by -E and... It builds correctly, without any error.
Comment 4 Alexandre Demers 2012-02-10 20:51:27 UTC
It seems reinstalling libc6-dev and linux-libc-dev fixed the problem. Thanks for the help though.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.