public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* RFA: Fix a 64-bit pointer to integer-of-a-different-size cast error
@ 2009-02-26 22:24 Kevin Buettner
  2009-03-02 22:48 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2009-02-26 22:24 UTC (permalink / raw)
  To: insight

Below is another patch which fixes a problem encountered on a 64-bit
build host.  The error is as follows:

../../src/gdb/gdbtk/generic/gdbtk-stack.c: In function 'gdb_get_vars_command':
../../src/gdb/gdbtk/generic/gdbtk-stack.c:288: error: cast from pointer to integer of different size

I disliked adding yet another cast, but know of no elegant way to
solve this problem.

I did verify that it was safe to make this cast; gdb_get_vars_command() 
obtains clientData only from small integral values.  (The values in question
would fit in a byte, if necessary.)

Okay?

gdbtk/generic/ChangeLog:

	* generic/gdbtk-stack.c (gdb_get_vars_command): Cast `clientData'
	to avoid pointer to integer-of-a-different-size error.

Index: gdbtk/generic/gdbtk-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-stack.c,v
retrieving revision 1.31
diff -u -p -r1.31 gdbtk-stack.c
--- gdbtk/generic/gdbtk-stack.c	27 Oct 2008 18:40:12 -0000	1.31
+++ gdbtk/generic/gdbtk-stack.c	26 Feb 2009 22:10:43 -0000
@@ -285,7 +285,7 @@ gdb_get_vars_command (ClientData clientD
       return TCL_ERROR;
     }
 
-  arguments = (int) clientData;
+  arguments = (int) (long) clientData;
 
   /* Initialize the result pointer to an empty list. */
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA: Fix a 64-bit pointer to integer-of-a-different-size cast  error
  2009-02-26 22:24 RFA: Fix a 64-bit pointer to integer-of-a-different-size cast error Kevin Buettner
@ 2009-03-02 22:48 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2009-03-02 22:48 UTC (permalink / raw)
  To: insight

On Thu, 26 Feb 2009 15:24:36 -0700
Kevin Buettner <kevinb@redhat.com> wrote:

> -  arguments = (int) clientData;
> +  arguments = (int) (long) clientData;

After some off-list discussion, Keith and I agreed on the following
patch instead:

	* generic/gdbtk-stack.c (gdb_get_vars_command): Revise cast of
	`clientData' to avoid build error on 64-bit hosts.

Index: generic/gdbtk-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-stack.c,v
retrieving revision 1.31
diff -u -p -r1.31 gdbtk-stack.c
--- generic/gdbtk-stack.c	27 Oct 2008 18:40:12 -0000	1.31
+++ generic/gdbtk-stack.c	2 Mar 2009 22:39:12 -0000
@@ -285,7 +285,7 @@ gdb_get_vars_command (ClientData clientD
       return TCL_ERROR;
     }
 
-  arguments = (int) clientData;
+  arguments = (long) clientData;
 
   /* Initialize the result pointer to an empty list. */
 

This patch has been committed.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-02 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 22:24 RFA: Fix a 64-bit pointer to integer-of-a-different-size cast error Kevin Buettner
2009-03-02 22:48 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).