[patch] Fix compile error for enable-build-with-cxx

Jerry Quinn jlquinn@optonline.net
Sun Oct 4 16:52:00 GMT 2009


Compile error for gimple.c

../../../gcc-in-cxx/gcc/gimple.c: In function ‘hashval_t
gimple_type_hash(const void*)’:
../../../gcc-in-cxx/gcc/gimple.c:3786: error: invalid const_cast from
type ‘const void*’ to type ‘tree_node*’

The following fixes it.  OK for mainline?


2009-10-04  Jerry Quinn  <jlquinn@optonline.net>

	* gimple.c (gimple_type_hash): Use CONST_CAST_TREE to fix
	compilation.

Index: gimple.c
===================================================================
--- gimple.c	(revision 152437)
+++ gimple.c	(working copy)
@@ -3767,6 +3767,7 @@
 static hashval_t
 gimple_type_hash (const void *p)
 {
+  const_tree t = (const_tree) p;
   VEC(tree, heap) *sccstack = NULL;
   struct pointer_map_t *sccstate;
   struct obstack sccstate_obstack;
@@ -3783,7 +3784,7 @@
   next_dfs_num = 1;
   sccstate = pointer_map_create ();
   gcc_obstack_init (&sccstate_obstack);
-  val = iterative_hash_gimple_type (CONST_CAST2 (tree, const void *,
p), 0,
+  val = iterative_hash_gimple_type (CONST_CAST_TREE (t), 0,
 				    &sccstack, sccstate, &sccstate_obstack);
   VEC_free (tree, heap, sccstack);
   pointer_map_destroy (sccstate);




More information about the Gcc-patches mailing list