xboard-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: [XBoard-devel] 64-bit alert


From: Tim Mann
Subject: Fwd: [XBoard-devel] 64-bit alert
Date: Mon, 30 Aug 2010 22:27:03 -0700

I sent this reply only to H.G. by mistake.

---------- Forwarded message ----------
From: Tim Mann <address@hidden>
Date: Mon, Aug 30, 2010 at 10:26 PM
Subject: Re: [XBoard-devel] 64-bit alert
To: "h.g. muller" <address@hidden>


I took a quick look, and all those warnings are harmless. I saw two kinds:

* Where you used the "union" argLoc field of ArgDescriptor to hold an int or boolean value instead of a pointer. The casts back to int or boolean are all safe, since the high-order bits of argLoc are unused in those cases. You can get rid of the warnings by casting to intptr_t instead of int -- intptr_t is a C standard type that means "whatever int type is the same size as a pointer". There is also a uintptr_t. That way the code will still compile cleanly on 32-bit too.

* Where you used a user data argument to some X function that's of type XtPointer to hold an int value. The places where you cast an int to XtPointer are safe since you aren't really creating a pointer. The places where you cast an XtPointer back to int are safe since again the high-order bits weren't used. Here too intptr_t would help. The casts to XtPointer may need a double cast: (XtPointer)(intptr_t) n. Ugly but correct here.

I would push a fix but I know I won't get to that tonight, so I'll just paste the error messages for now. Hope that will help, though I realize your line numbers are probably different from what I just pulled from git.

There is also one other warning apparently caused by not declaring a prototype for SFsetText.

    gcc -DHAVE_CONFIG_H -I. -I..  -DINFODIR='"/usr/local/share/info"'   -DSYSCONFDIR='"/usr/local/etc"'    -MT xboard.o -MD -MP -MF $depbase.Tpo -c -o xboard.o ../xboard.c &&\
    mv -f $depbase.Tpo $depbase.Po
In file included from ../xboard.c:1347:
../args.h: In function ‘ParseArgs’:
../args.h:999: warning: cast from pointer to integer of different size
../args.h:1013: warning: cast from pointer to integer of different size
../args.h: In function ‘SetDefaultsFromList’:
../args.h:1109: warning: cast from pointer to integer of different size
../args.h:1115: warning: cast from pointer to integer of different size
../args.h:1123: warning: cast from pointer to integer of different size
../args.h:1126: warning: cast from pointer to integer of different size
../xboard.c: In function ‘SaveFontArg’:
../xboard.c:1454: warning: cast from pointer to integer of different size
../xboard.c: In function ‘SaveAttribsArg’:
../xboard.c:1486: warning: cast from pointer to integer of different size
../xboard.c: In function ‘SaveColor’:
../xboard.c:1492: warning: cast from pointer to integer of different size
../xboard.c:1493: warning: cast from pointer to integer of different size
...
    gcc -DHAVE_CONFIG_H -I. -I..  -DINFODIR='"/usr/local/share/info"'   -DSYSCONFDIR='"/usr/local/etc"'    -MT filebrowser/selfile.o -MD -MP -MF $depbase.Tpo -c -o filebrowser/selfile.o ../filebrowser/selfile.c &&\
    mv -f $depbase.Tpo $depbase.Po
../filebrowser/selfile.c: In function ‘SFcreateWidgets’:
../filebrowser/selfile.c:421: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:423: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:438: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:440: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:499: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:501: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:503: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:505: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:507: warning: cast to pointer from integer of different size
../filebrowser/selfile.c:509: warning: cast to pointer from integer of different size
depbase=`echo filebrowser/draw.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    gcc -DHAVE_CONFIG_H -I. -I..  -DINFODIR='"/usr/local/share/info"'   -DSYSCONFDIR='"/usr/local/etc"'    -MT filebrowser/draw.o -MD -MP -MF $depbase.Tpo -c -o filebrowser/draw.o ../filebrowser/draw.c &&\
    mv -f $depbase.Tpo $depbase.Po
../filebrowser/draw.c: In function ‘SFscrollTimer’:
../filebrowser/draw.c:503: warning: cast from pointer to integer of different size
../filebrowser/draw.c:533: warning: cast to pointer from integer of different size
../filebrowser/draw.c: In function ‘SFnewInvertEntry’:
../filebrowser/draw.c:574: warning: cast to pointer from integer of different size
depbase=`echo filebrowser/path.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    gcc -DHAVE_CONFIG_H -I. -I..  -DINFODIR='"/usr/local/share/info"'   -DSYSCONFDIR='"/usr/local/etc"'    -MT filebrowser/path.o -MD -MP -MF $depbase.Tpo -c -o filebrowser/path.o ../filebrowser/path.c &&\
    mv -f $depbase.Tpo $depbase.Po
../filebrowser/path.c:684: warning: conflicting types for ‘SFsetText’
../filebrowser/path.c:193: note: previous implicit declaration of ‘SFsetText’ was here


On Mon, Aug 30, 2010 at 9:31 PM, Tim Mann <address@hidden> wrote:
That's unfortunate. I've used mostly 64-bit systems for many years -- ever since the DEC Alpha became available within DEC, where I worked at the time -- and my releases of xboard were 64-bit clean from then on.

However, if I remember right, the last time I tried to compile xboard, it did get a lot of those warnings but they were actually harmless. I think it was a case where you were passing some small integer value through some X callback that takes a (void *), then casting back to a 32-bit type later. I thought I'd sent some mail about that, if not even a patch... maybe I forgot to.

When I get some time I will try compiling again and let you know what I find. The last couple of months have been crazy but after this week things will slow down a bit for me. Though I'll still have a backlog of stuff to catch up on.


On Mon, Aug 30, 2010 at 6:34 AM, h.g. muller <address@hidden> wrote:
It seems when someone tries to install XBoard from source on a 64-bit system,
the 'make' process results in lots of warnings (args.h, selfile.c, draw.c) of a type
that indeed looks quite lethal: "cast from pointer to integer of different size".

I guess the current XBoard code is not suitable for compiling as 64-bit application.
But apparently we fail to tell the compiler that in our Makefile.

The quick fix would be to include such a flag. (Does anyone know what it is?)
In the longer run we sould have to clean up the code with respect to pointer <-> int
conversions. I cannot test anything of this, as I have no 64-bit systems.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]