[RFC] sim/sh: Fix compile warnings for 64-bit build hosts

Mike Frysinger vapier@gentoo.org
Fri Feb 17 01:21:00 GMT 2012


On Thursday 16 February 2012 18:31:16 Kevin Buettner wrote:
> On Wed, 15 Feb 2012 23:50:34 -0500 Mike Frysinger wrote:
> > On Wednesday 15 February 2012 19:26:22 Kevin Buettner wrote:
> > > Any comments on the following patch?
> > 
> > uintptr_t i think would be better, but we don't seem to use that in sim/,
> > so this is OK
> > 
> > > It fixes a bunch of warnings when building on a 64-bit host.  Here
> > > are a few of them:
> > > 
> > > ./code.c:93: warning: cast from pointer to integer of different size
> > > ./code.c:215: warning: cast from pointer to integer of different size
> > > ./code.c:230: warning: cast from pointer to integer of different size
> > 
> > makes me think that this sim is incorrectly mixing target and host types
> 
> My reading of the code shows that (the variable behind) PC is char *.
> (PC is a macro defined to be insn_ptr.) The MA macro needs to convert
> that pointer to an int type in order to apply the mask.  So I agree
> that uintptr_t would be the right thing to use.
> 
> I've committed my patch, but if you wish I can try it with uintptr_t.
> This will require us to include stdint.h.

i don't think fixing this tiny issue would measurably improve the code, so 
don't worry about it.  to truly make the code better, the PC would need to not 
be a pointer but rather uint32_t (for 32bit SuperH procs) and uin64_t (for 
64bit SuperH procs).  and i imagine that is way more work than you want to 
take on ;).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120217/b795fcbb/attachment.sig>


More information about the Gdb-patches mailing list