aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-09-05 10:47:05 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-09-05 10:47:05 +0000
commitf38fb2c44b2a6333581e8a4cc314efb00ce7d18a (patch)
tree67feb12fc771c5fabd29cc9489e084e60304dbdd /gcc/tree-ssa-alias.c
parente7a8f681c069f09f53be3f94e220669247379a48 (diff)
downloadgcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.zip
gcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.tar.gz
gcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.tar.bz2
re PR tree-optimization/45535 (ICE during tree_ssa_dse)
2010-09-05 Richard Guenther <rguenther@suse.de> PR tree-optimization/45535 * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Properly handle TMR_INDEX2. Make sure TMR_INDEX is not NULL before dereferencing it. (indirect_refs_may_alias_p): Likewise. * gcc.c-torture/compile/pr45535.c: New testcase. From-SVN: r163877
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index a9f1c19..e00c50a 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -693,7 +693,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
(the pointer base cannot validly point to an offset less than zero
of the variable).
They also cannot alias if the pointer may not point to the decl. */
- if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1))
+ if ((TREE_CODE (base1) != TARGET_MEM_REF
+ || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& !ranges_overlap_p (MAX (0, offset1p), -1, offset2p, max_size2))
return false;
if (!ptr_deref_may_alias_decl_p (ptr1, base2))
@@ -725,7 +726,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
is relative to the start of the type which we ensure by
comparing rvalue and access type and disregarding the constant
pointer offset. */
- if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1))
+ if ((TREE_CODE (base1) != TARGET_MEM_REF
+ || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& (TREE_CODE (base1) != MEM_REF
|| same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)
&& same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (base2)) == 1)
@@ -807,16 +809,23 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if ((!cfun || gimple_in_ssa_p (cfun))
&& operand_equal_p (ptr1, ptr2, 0)
&& (((TREE_CODE (base1) != TARGET_MEM_REF
- || !TMR_INDEX (base1))
+ || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& (TREE_CODE (base2) != TARGET_MEM_REF
- || !TMR_INDEX (base2)))
+ || (!TMR_INDEX (base2) && !TMR_INDEX2 (base2))))
|| (TREE_CODE (base1) == TARGET_MEM_REF
&& TREE_CODE (base2) == TARGET_MEM_REF
&& (TMR_STEP (base1) == TMR_STEP (base2)
|| (TMR_STEP (base1) && TMR_STEP (base2)
&& operand_equal_p (TMR_STEP (base1),
TMR_STEP (base2), 0)))
- && operand_equal_p (TMR_INDEX (base1), TMR_INDEX (base2), 0))))
+ && (TMR_INDEX (base1) == TMR_INDEX (base2)
+ || (TMR_INDEX (base1) && TMR_INDEX (base2)
+ && operand_equal_p (TMR_INDEX (base1),
+ TMR_INDEX (base2), 0)))
+ && (TMR_INDEX2 (base1) == TMR_INDEX2 (base2)
+ || (TMR_INDEX2 (base1) && TMR_INDEX2 (base2)
+ && operand_equal_p (TMR_INDEX2 (base1),
+ TMR_INDEX2 (base2), 0))))))
{
/* The offset embedded in MEM_REFs can be negative. Bias them
so that the resulting offset adjustment is positive. */