This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix for 64bit uncleanliness in cp/class.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: fix for 64bit uncleanliness in cp/class.c
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Tue, 18 Jan 2000 16:01:06 -0500 (EST)
- Cc: lucier at math dot purdue dot edu
The following warning messages in building cpp/class.c on
alphaev6-unknown-linux-gnu usually indicates an error on the alpha:
../../../gcc/cp/class.c: In function `dump_class_hierarchy':
../../../gcc/cp/class.c:6301: warning: cast from pointer to integer of different size
../../../gcc/cp/class.c:6304: warning: int format, different type arg (arg 7)
To fix the first problem, I believe we should cast the pointer to an
unsigned long, not unsigned int, and use %lx, not %x as the format; see
the similar discussion in
http://gcc.gnu.org/ml/gcc-patches/1999-12/msg00321.html
Also, we have in tree.h
#define TREE_INT_CST_LOW(NODE) (INTEGER_CST_CHECK (NODE)->int_cst.int_cst_low)
and int_cst_low is a HOST_WIDE_INT, so I suggest the following patch:
* cp/class.c (dump_class_hierarchy): make format agree with argument;
cast pointer to unsigned long and print with %lx
RCS file: RCS/class.c,v
retrieving revision 1.1
diff -c -r1.1 class.c
*** class.c 2000/01/18 20:09:26 1.1
--- class.c 2000/01/18 20:47:36
***************
*** 6297,6304 ****
{
int i;
! fprintf (stderr, "%*s0x%x (%s) %d %s\n", indent, "",
! (unsigned int) binfo,
type_as_string (binfo, TS_PLAIN),
TREE_INT_CST_LOW (BINFO_OFFSET (binfo)),
BINFO_PRIMARY_MARKED_P (binfo) ? "primary" : "");
--- 6297,6304 ----
{
int i;
! fprintf (stderr, "%*s0x%lx (%s) %ld %s\n", indent, "",
! (unsigned long) binfo,
type_as_string (binfo, TS_PLAIN),
TREE_INT_CST_LOW (BINFO_OFFSET (binfo)),