From: Richard Biener Date: Thu, 1 Dec 2016 12:15:44 +0000 (+0000) Subject: tree-ssa-alias.c (indirect_refs_may_alias_p): Do not treat arrays with same type... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1fc386ac283d309eb6af8cf7b009d528bc52a9a;p=gcc.git 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 * 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: r243106 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2683757d1b2..19cb0ce48f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-12-01 Richard Biener + + * tree-ssa-alias.c (indirect_refs_may_alias_p): Do not + treat arrays with same type as objects that cannot overlap. + 2016-12-01 Georg-Johann Lay * config/avr/avr.c (avr_print_operand): Use SYMBOL_REF_P if possible. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab55b438fcc..447d9fb4b4d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-12-01 Richard Biener + + * gcc.dg/torture/alias-2.c: New testcase. + 2016-12-01 Georg-Johann Lay * gcc.target/avr/tiny-memx.c: Only perform if target avr_tiny. diff --git a/gcc/testsuite/gcc.dg/torture/alias-2.c b/gcc/testsuite/gcc.dg/torture/alias-2.c new file mode 100644 index 00000000000..329d46a5eb9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/alias-2.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +/* We do not want to treat int[3] as an object that cannot overlap + itself but treat it as arbitrary sub-array of a larger array object. */ +int ar1(int (*p)[3], int (*q)[3]) +{ + (*p)[0] = 1; + (*q)[1] = 2; + return (*p)[0]; +} +int main() +{ + int a[4]; + if (ar1 ((int (*)[3])&a[1], (int (*)[3])&a[0]) != 2) + __builtin_abort (); + return 0; +}