OSDN Git Service

2006-11-11 Andrew Pinski <andrew_pinski@playstation.sony.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Nov 2006 01:10:56 +0000 (01:10 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Nov 2006 01:10:56 +0000 (01:10 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118716 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 05358b1..3cca0dc 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 7c51ad7..d027b79 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 be5d63c..525ac64 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;
+}
+
+