diff options
author | Olga Golovanevsky <olga@il.ibm.com> | 2009-11-30 14:42:54 +0000 |
---|---|---|
committer | Olga Golovanevsky <olga@gcc.gnu.org> | 2009-11-30 14:42:54 +0000 |
commit | 0f79311b1012d84125088eaf252d6b8824b3bb81 (patch) | |
tree | 2e6f3db6220868ec9928d6f32e8df7770eee63de /gcc/ipa-struct-reorg.c | |
parent | 0727601add7a6b06c1b114389707878a33b731a6 (diff) | |
download | gcc-0f79311b1012d84125088eaf252d6b8824b3bb81.tar.gz |
re PR tree-optimization/39806 (incorrect pointer hashing in ipa-struct-reorg.c)
2009-11-30 Olga Golovanevsky <olga@il.ibm.com>
PR middle-end/39806
* ipa-struct-reorg.c (new_var_eq): Use DECL_UID to hash new variables.
(new_var_hash): Likewise.
(is_in_new_vars_htab): Likewise.
(add_to_new_vars_htab): Likewise.
From-SVN: r154811
Diffstat (limited to 'gcc/ipa-struct-reorg.c')
-rw-r--r-- | gcc/ipa-struct-reorg.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c index 0cb7ccca31b..e1dddae999e 100644 --- a/gcc/ipa-struct-reorg.c +++ b/gcc/ipa-struct-reorg.c @@ -569,7 +569,7 @@ static new_var is_in_new_vars_htab (tree decl, htab_t new_vars_htab) { return (new_var) htab_find_with_hash (new_vars_htab, decl, - htab_hash_pointer (decl)); + DECL_UID (decl)); } /* Given original variable ORIG_VAR, this function returns @@ -1962,7 +1962,7 @@ add_to_new_vars_htab (new_var new_node, htab_t new_vars_htab) void **slot; slot = htab_find_slot_with_hash (new_vars_htab, new_node->orig_var, - htab_hash_pointer (new_node->orig_var), + DECL_UID (new_node->orig_var), INSERT); *slot = new_node; } @@ -2254,15 +2254,19 @@ create_new_var (tree var_decl, htab_t new_vars_htab) static hashval_t new_var_hash (const void *x) { - return htab_hash_pointer (((const_new_var)x)->orig_var); + return DECL_UID (((const_new_var)x)->orig_var); } -/* This function returns nonzero if orig_var of new_var X is equal to Y. */ +/* This function returns nonzero if orig_var of new_var X + and tree Y have equal UIDs. */ static int new_var_eq (const void *x, const void *y) { - return ((const_new_var)x)->orig_var == (const_tree)y; + if (DECL_P ((const_tree)y)) + return DECL_UID (((const_new_var)x)->orig_var) == DECL_UID ((const_tree)y); + else + return 0; } /* This function check whether a structure type represented by STR |