summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-address.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-26 13:01:48 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-26 13:01:48 +0000
commita07f662934c2720357d3ea868381918df727a238 (patch)
tree6ba8d1096dc8083667067ab711fce8126259c02e /gcc/tree-ssa-address.c
parentc37ec47f4be1fff02f345270b65b7ce0b6f7c8e0 (diff)
downloadgcc-a07f662934c2720357d3ea868381918df727a238.tar.gz
2011-05-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48702 * tree-ssa-address.c (create_mem_ref_raw): Create MEM_REFs only when we know the base address is within bounds. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Do not assume the base address of TARGET_MEM_REFs is in bounds. * gcc.dg/torture/pr48702.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174282 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-address.c')
-rw-r--r--gcc/tree-ssa-address.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 07d1d4db43b..2e6eabc8ccb 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -361,8 +361,11 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr,
index2 = addr->base;
}
- /* If possible use a plain MEM_REF instead of a TARGET_MEM_REF. */
- if (alias_ptr_type
+ /* If possible use a plain MEM_REF instead of a TARGET_MEM_REF.
+ ??? As IVOPTs does not follow restrictions to where the base
+ pointer may point to create a MEM_REF only if we know that
+ base is valid. */
+ if (TREE_CODE (base) == ADDR_EXPR
&& (!index2 || integer_zerop (index2))
&& (!addr->index || integer_zerop (addr->index)))
return fold_build2 (MEM_REF, type, base, addr->offset);