diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-22 13:39:18 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-22 13:39:18 +0000 |
commit | e911adadf279416c4acaa4479b60c0ad020159db (patch) | |
tree | a90ff2874706640af3b68570fabd2d4bcd045798 /gcc/tree-ssa-alias.c | |
parent | e600139e603ff83608932fc41cbde0226f95cf36 (diff) | |
download | gcc-e911adadf279416c4acaa4479b60c0ad020159db.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102283 138bc75d-0d04-0410-961f-82ee72b054a4
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 c65fe8d043f..76d883ab64c 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; |