diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-24 09:27:47 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-24 09:27:47 +0000 |
commit | a5134cedf26e38e88ba09d9ef0dbca88e3318bab (patch) | |
tree | b4e6538253993decb91c5f31f992ce1e251da9bb /gcc/tree-dfa.c | |
parent | 921b27c08469091b2621f84f985e6e4d916da6a5 (diff) | |
download | gcc-a5134cedf26e38e88ba09d9ef0dbca88e3318bab.tar.gz |
2008-05-24 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (refs_may_alias_p): Re-instantiate case that
a scalar variable can be only accessed through a pointer
or a union.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135846 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 02d2139d3b3..7e4bb7681b7 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -1078,8 +1078,23 @@ refs_may_alias_p (tree ref1, tree ref2) /* If one base is a ref-all pointer weird things are allowed. */ strict_aliasing_applies = (flag_strict_aliasing - && get_alias_set (base1) != 0 - && get_alias_set (base2) != 0); + && (!INDIRECT_REF_P (base1) + || get_alias_set (base1) != 0) + && (!INDIRECT_REF_P (base2) + || get_alias_set (base2) != 0)); + + /* If strict aliasing applies the only way to access a scalar variable + is through a pointer dereference or through a union (gcc extension). */ + if (strict_aliasing_applies + && ((SSA_VAR_P (ref2) + && !AGGREGATE_TYPE_P (TREE_TYPE (ref2)) + && !INDIRECT_REF_P (ref1) + && TREE_CODE (TREE_TYPE (base1)) != UNION_TYPE) + || (SSA_VAR_P (ref1) + && !AGGREGATE_TYPE_P (TREE_TYPE (ref1)) + && !INDIRECT_REF_P (ref2) + && TREE_CODE (TREE_TYPE (base2)) != UNION_TYPE))) + return false; /* If both references are through the same type, or if strict aliasing doesn't apply they are through two same pointers, they do not alias |