aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenth@gcc.gnu.org>2016-12-01 12:22:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-12-01 12:22:32 +0000
commita41e62e743af77da51413bd6f865f4c270f11674 (patch)
tree0bb6e979e59d10f3a0fc82f0f8851c637f94614a /gcc/tree-ssa-alias.c
parenta1fc386ac283d309eb6af8cf7b009d528bc52a9a (diff)
downloadgcc-a41e62e743af77da51413bd6f865f4c270f11674.zip
gcc-a41e62e743af77da51413bd6f865f4c270f11674.tar.gz
gcc-a41e62e743af77da51413bd6f865f4c270f11674.tar.bz2
tree-ssa-alias.c (indirect_refs_may_alias_p): Do not treat arrays with same type as objects that cannot overlap.
2016-12-01 Richard Biener <rguenther@suse.de> * tree-ssa-alias.c (indirect_refs_may_alias_p): Do not treat arrays with same type as objects that cannot overlap. * gcc.dg/torture/alias-2.c: New testcase. From-SVN: r243107
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index ebae6cf..10f1677 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1355,7 +1355,10 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
&& same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1
&& same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1
&& same_type_for_tbaa (TREE_TYPE (ptrtype1),
- TREE_TYPE (ptrtype2)) == 1)
+ TREE_TYPE (ptrtype2)) == 1
+ /* But avoid treating arrays as "objects", instead assume they
+ can overlap by an exact multiple of their element size. */
+ && TREE_CODE (TREE_TYPE (ptrtype1)) != ARRAY_TYPE)
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
/* Do type-based disambiguation. */