On Sun, Dec 09, 2007 at 08:44:05AM +0900, Masayuki Hatta wrote:
> Hi,
> 
> >>>>> In <[EMAIL PROTECTED]> 
> >>>>> Kurt Roeckx <[EMAIL PROTECTED]> wrote:
> 
> > Your package is failing to build on the 64 bit arches with the following
> > error:
> > cc1: warnings being treated as errors
> > .././gdb/gdbtk/generic/gdbtk-register.c: In function 'get_register_name':
> > .././gdb/gdbtk/generic/gdbtk-register.c:348: warning: cast from pointer to 
> > integer of different size
> 
> > Note that there are plenty of warnings like that, but the rest
> > doesn't seem to be compiled with -Werror.
> 
> The offending lines are something like:
> 
> int numbers = (int) argp;

So looking at the code, it does:
            argp = (void *) 1;
[...]      
        func = get_register_name;
[...]
        func (regnum, argp);

As far as I can see, it it contains NULL or 1.  So it looks to me
like it's just passing either the number 0 or 1 to the function, but
for some reason thinks it should pass it as a pointer.

This isn't really portable, since NULL might not be an "all bits zero"
value.  Atleast for this file, I suggest you change all those "void *"
to just "int".

> So it seems this is one of those 32bit/64bit pointer size difference
> issues.

It shouldn't be passing integers via a pointer, or pointers via a
integer.

> However, I'm not sure how to fix this (I don't have any 64bit arch
> machine and know little about it).  Do you have any idea?  Does
> "intptr_t numbers = (int) argp" work for you?

"intptr_t numbers = (intptr_t) argp;" might work.  The (int) there
just has the same problem, you'd cast it to a 32 bit number, and then
back to a 64 bit number.

Anyway, since it's just 0 / 1 in this file it shouldn't cause problems
with the cast on any of the arches in Debian.  You only have a problem
when you do it with a real pointer.


Kurt




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to