diff options
author | Diego Novillo <dnovillo@redhat.com> | 2005-07-22 13:39:18 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2005-07-22 09:39:18 -0400 |
commit | 17c7e33e8c288eda8ec9316dad5daea43299f584 (patch) | |
tree | a90ff2874706640af3b68570fabd2d4bcd045798 /gcc/tree-ssa-alias.c | |
parent | 191e1ff2f56a8b5148ccca1e3c30283af9905cee (diff) | |
download | gcc-17c7e33e8c288eda8ec9316dad5daea43299f584.zip gcc-17c7e33e8c288eda8ec9316dad5daea43299f584.tar.gz gcc-17c7e33e8c288eda8ec9316dad5daea43299f584.tar.bz2 |
tree-ssa-alias.c (count_ptr_derefs): Do not consider &PTR->FLD a dereference of PTR.
* tree-ssa-alias.c (count_ptr_derefs): Do not consider
&PTR->FLD a dereference of PTR.
* tree-ssa-structalias.c (update_alias_info): Consider &PTR->FLD
a potential dereference of PTR.
testsuite/ChangeLog
* gcc.dg/tree-ssa/20050719-1.c: New test.
From-SVN: r102283
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index c65fe8d..76d883a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -344,12 +344,20 @@ struct count_ptr_d (ALIGN/MISALIGNED_)INDIRECT_REF nodes for the pointer passed in DATA. */ static tree -count_ptr_derefs (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data) +count_ptr_derefs (tree *tp, int *walk_subtrees, void *data) { struct count_ptr_d *count_p = (struct count_ptr_d *) data; + /* Do not walk inside ADDR_EXPR nodes. In the expression &ptr->fld, + pointer 'ptr' is *not* dereferenced, it is simply used to compute + the address of 'fld' as 'ptr + offsetof(fld)'. */ + if (TREE_CODE (*tp) == ADDR_EXPR) + { + *walk_subtrees = 0; + return NULL_TREE; + } + if (INDIRECT_REF_P (*tp) && TREE_OPERAND (*tp, 0) == count_p->ptr) -/* || (TREE_CODE (*tp) == MEM_REF && MEM_REF_SYMBOL (*tp) == count_p->ptr)) */ count_p->count++; return NULL_TREE; |