This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] sim/sh: Fix compile warnings for 64-bit build hosts
On Wed, 15 Feb 2012 23:50:34 -0500
Mike Frysinger <vapier@gentoo.org> 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.
Kevin