aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2011-03-07 15:32:25 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2011-03-07 15:32:25 +0000
commita19e4d44f1f424afa351d2f4b79a28b8c5ae7cc6 (patch)
tree963140ba824737698d21be14b933d8f0e66f3af1 /gcc/c-family
parent59527282380bdf54087204235cc7330cd44b067a (diff)
downloadgcc-a19e4d44f1f424afa351d2f4b79a28b8c5ae7cc6.zip
gcc-a19e4d44f1f424afa351d2f4b79a28b8c5ae7cc6.tar.gz
gcc-a19e4d44f1f424afa351d2f4b79a28b8c5ae7cc6.tar.bz2
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
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c9
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f89502d..60fc08f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c/47809
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index d696b5f..f029661 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4035,7 +4035,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
static hashval_t
c_type_hash (const void *p)
{
- int i = 0;
+ int n_elements;
int shift, size;
const_tree const t = (const_tree) p;
tree t2;
@@ -4064,14 +4064,15 @@ c_type_hash (const void *p)
default:
gcc_unreachable ();
}
- for (; t2; t2 = DECL_CHAIN (t2))
- i++;
+ /* FIXME: We want to use a DECL_CHAIN iteration method here, but
+ TYPE_VALUES of ENUMERAL_TYPEs is stored as a TREE_LIST. */
+ n_elements = list_length (t2);
/* We might have a VLA here. */
if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
size = 0;
else
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;