+2013-11-05 Marc Glisse <marc.glisse@inria.fr>
+
+ * tree-ssa-alias.h (ranges_overlap_p): Handle negative offsets.
+ * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Likewise.
+
2013-11-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/58984
+2013-11-05 Marc Glisse <marc.glisse@inria.fr>
+
+ * gcc.dg/tree-ssa/alias-26.c: New file.
+
2013-11-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/58984
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+void f (const char *c, int *i)
+{
+ *i = 42;
+ __builtin_memcpy (i - 1, c, sizeof (int));
+ if (*i != 42) __builtin_abort();
+}
+
+/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
}
/* Init an alias-oracle reference representation from a gimple pointer
- PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE the the
+ PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE then the
size is assumed to be unknown. The access is assumed to be only
to or after of the pointer target, not before it. */
ptr = gimple_assign_rhs1 (stmt);
else if (is_gimple_assign (stmt)
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
- && host_integerp (gimple_assign_rhs2 (stmt), 0)
- && (t1 = int_cst_value (gimple_assign_rhs2 (stmt))) >= 0)
+ && TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST)
{
ptr = gimple_assign_rhs1 (stmt);
- extra_offset = BITS_PER_UNIT * t1;
+ extra_offset = BITS_PER_UNIT
+ * int_cst_value (gimple_assign_rhs2 (stmt));
}
}
range is open-ended. Otherwise return false. */
static inline bool
-ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
+ranges_overlap_p (HOST_WIDE_INT pos1,
unsigned HOST_WIDE_INT size1,
- unsigned HOST_WIDE_INT pos2,
+ HOST_WIDE_INT pos2,
unsigned HOST_WIDE_INT size2)
{
if (pos1 >= pos2
&& (size2 == (unsigned HOST_WIDE_INT)-1
- || pos1 < (pos2 + size2)))
+ || pos1 < (pos2 + (HOST_WIDE_INT) size2)))
return true;
if (pos2 >= pos1
&& (size1 == (unsigned HOST_WIDE_INT)-1
- || pos2 < (pos1 + size1)))
+ || pos2 < (pos1 + (HOST_WIDE_INT) size1)))
return true;
return false;