Commit a19e4d44 by Nathan Froyd Committed by Nathan Froyd

re PR c/47786 (tree check: expected tree that contains 'decl minimal' structure,…

re PR c/47786 (tree check: expected tree that contains 'decl minimal' structure, have 'tree_list' in c_type_hash, at c-family/c-common.c:4066)

	PR c/47786
	* c-common.c (c_type_hash): Call list_length instead of iterating
	through DECL_CHAIN.  Rename 'i' to 'n_elements'.

From-SVN: r170739
parent 59527282
2011-03-07 Nathan Froyd <froydnj@codesourcery.com>
PR c/47786
* c-common.c (c_type_hash): Call list_length instead of iterating
through DECL_CHAIN. Rename 'i' to 'n_elements'.
2011-02-19 Jakub Jelinek <jakub@redhat.com> 2011-02-19 Jakub Jelinek <jakub@redhat.com>
PR c/47809 PR c/47809
......
...@@ -4035,7 +4035,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl) ...@@ -4035,7 +4035,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
static hashval_t static hashval_t
c_type_hash (const void *p) c_type_hash (const void *p)
{ {
int i = 0; int n_elements;
int shift, size; int shift, size;
const_tree const t = (const_tree) p; const_tree const t = (const_tree) p;
tree t2; tree t2;
...@@ -4064,14 +4064,15 @@ c_type_hash (const void *p) ...@@ -4064,14 +4064,15 @@ c_type_hash (const void *p)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
for (; t2; t2 = DECL_CHAIN (t2)) /* FIXME: We want to use a DECL_CHAIN iteration method here, but
i++; TYPE_VALUES of ENUMERAL_TYPEs is stored as a TREE_LIST. */
n_elements = list_length (t2);
/* We might have a VLA here. */ /* We might have a VLA here. */
if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST) if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
size = 0; size = 0;
else else
size = TREE_INT_CST_LOW (TYPE_SIZE (t)); size = TREE_INT_CST_LOW (TYPE_SIZE (t));
return ((size << 24) | (i << shift)); return ((size << 24) | (n_elements << shift));
} }
static GTY((param_is (union tree_node))) htab_t type_hash_table; static GTY((param_is (union tree_node))) htab_t type_hash_table;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment