Bug 2924

Summary: VIA/i915/tdfx/savage drivers have questionable pointer-to-int casting (x86-64)
Product: Mesa Reporter: Ian Romanick <idr>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: alexdeucher
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: All pointer / int cast related warnings from a linux-dri-x86-64 build.
Fixes for point-to-int casts in the Savage driver

Description Ian Romanick 2005-04-07 10:52:19 UTC
These drivers have some questionable pointer casting that causes GCC to generate
warnings on x86-64 systems.  I looked at a couple cases in the Unichrome driver,
and they appear to be things like this:

vmesa->regEngineStatus = (GLuint *)((GLuint)viaScreen->reg + 0x400);

That line actually generates *2* warnings.  One is for the cast from drmAddress
(viaScreen->reg) to a GLuint, and the other is for the cast from GLuint to GLuint*.

I don't have any hardware that I can put in my x86-64 box to "verify" a fix to
this.  However, it seems like the right fix is to replace
'(GLuint)viaScreen->reg + 0x400' with '(GLubyte *)viaScreen->reg + 0x400'.  That
should generate the right result without the funky pointer-to-int casting.
Comment 1 Ian Romanick 2005-04-07 10:53:06 UTC
Created attachment 2345 [details]
All pointer / int cast related warnings from a linux-dri-x86-64 build.
Comment 2 Felix Kühling 2005-04-07 13:23:32 UTC
Created attachment 2347 [details] [review]
Fixes for point-to-int casts in the Savage driver

The attached patch should fix the warnings in the savage driver. I can only
test this on a 32-bit platform though. Feel free to apply this or complain if I
missed something.
Comment 3 Tormod Volden 2007-04-25 16:20:17 UTC
Fix released long time ago.
Comment 4 Adam Jackson 2009-08-24 12:23:09 UTC
Mass version move, cvs -> git

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.