]> gcc.gnu.org Git - gcc.git/commitdiff
re PR rtl-optimization/28812 (RTL aliasing vs may_alias and structs)
authorAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 12 Nov 2006 01:10:56 +0000 (17:10 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 12 Nov 2006 01:10:56 +0000 (17:10 -0800)
2006-11-11  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/28812
        * alias.c (fixed_scalar_and_varying_struct_p): Don't return a
        non null value if the struct memory access is in the 0th
        aliasing set.

2006-11-11  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/28812
        * gcc.c-torture/execute/mayalias-3.c: New test.

From-SVN: r118716

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/mayalias-3.c [new file with mode: 0644]

index 05358b10010e663b4cee9dee054c5f930cd386a6..3cca0dcc2d364d757e952b6f62cc9530fd76fbdd 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-11  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR rtl-opt/28812
+       * alias.c (fixed_scalar_and_varying_struct_p): Don't return a
+       non null value if the struct memory access is in the 0th
+       aliasing set.
+
 2006-11-12  Jie Zhang  <jie.zhang@analog.com>
 
        Revert
index 7c51ad79dd6066f9af3b7f43581ca41ccb742662..d027b79a053e9519f301f15ccba285bd83626c7d 100644 (file)
@@ -1857,13 +1857,15 @@ fixed_scalar_and_varying_struct_p (rtx mem1, rtx mem2, rtx mem1_addr,
   if (! flag_strict_aliasing)
     return NULL_RTX;
 
-  if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
+  if (MEM_ALIAS_SET (mem2)
+      && MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
       && !varies_p (mem1_addr, 1) && varies_p (mem2_addr, 1))
     /* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
        varying address.  */
     return mem1;
 
-  if (MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2)
+  if (MEM_ALIAS_SET (mem1)
+      && MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2)
       && varies_p (mem1_addr, 1) && !varies_p (mem2_addr, 1))
     /* MEM2 is a scalar at a fixed address; MEM1 is a struct at a
        varying address.  */
index be5d63cebf6a5f9ff78f231dfcf5f49af26fddd2..525ac64774bd6c07d11481a6a3484ada825794b4 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-11  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR rtl-opt/28812
+       * gcc.c-torture/execute/mayalias-3.c: New test.
+
 2006-11-11  Richard Sandiford  <richard@codesourcery.com>
 
        PR middle-end/27528
@@ -12,8 +17,8 @@
 
 2006-11-10 Paul Thomas <pault@gcc.gnu.org>
 
-   PR fortran/29758
-   * gfortran.dg/reshape_source_size_1.f90: New test.
+       PR fortran/29758
+       * gfortran.dg/reshape_source_size_1.f90: New test.
 
 2006-11-10 Paul Thomas <pault@gcc.gnu.org>
 
@@ -23,7 +28,7 @@
 2006-11-10  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/29777
-        * lib/target-supports.exp (vect_widen_mult_hi_to_si): Add i?86-*-*
+       * lib/target-supports.exp (vect_widen_mult_hi_to_si): Add i?86-*-*
        and x86_64-*-* targets.
 
 2006-11-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c
new file mode 100644 (file)
index 0000000..3d66791
--- /dev/null
@@ -0,0 +1,27 @@
+struct S { short x; };
+typedef struct S __attribute__((__may_alias__)) test;
+
+test *p;
+
+int g(int *a)
+{
+ p = (test*)a;
+}
+
+int f()
+{
+  int a;
+  g(&a);
+  a = 10;
+  test s={1};
+  *p=s;
+  return a;
+}
+
+int main() {
+  if (f() == 10)
+    __builtin_abort();
+  return 0;
+}
+
+
This page took 0.113604 seconds and 5 git commands to generate.