OSDN Git Service

PR 22591
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jul 2005 19:53:54 +0000 (19:53 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jul 2005 19:53:54 +0000 (19:53 +0000)
* tree-ssa-alias.c (may_alias_p): Remove shortcut that tests
whether a pointer of type T * may point to objects of type T *.

testsuite/ChangeLog

PR 22591
* gcc.dg/tree-ssa/pr22591.c: New test.
* gcc.dg/tree-ssa/20030807-7.c: XFAIL everywhere.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
gcc/testsuite/gcc.dg/tree-ssa/pr22591.c [new file with mode: 0644]
gcc/tree-ssa-alias.c

index dd893ba..614b253 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-26  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 22591
+       * tree-ssa-alias.c (may_alias_p): Remove shortcut that tests
+       whether a pointer of type T * may point to objects of type T *.
+
 2005-07-26  DJ Delorie  <dj@redhat.com>
 
        * configure: Regenerate.
index c4df73c..1025b6b 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-26  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 22591
+       * gcc.dg/tree-ssa/pr22591.c: New test.
+       * gcc.dg/tree-ssa/20030807-7.c: XFAIL everywhere.
+
 2005-07-26  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR libobjc/22606
index 2dc2083..253c27a 100644 (file)
@@ -34,5 +34,5 @@ simplify_condition (cond_p)
 
 /* There should be exactly one IF conditional.  TBAA is not able to 
    determine that 'decl' and 'cond' can't alias.  */
-/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */
+/* { dg-final { scan-tree-dump-times "if " 1 "dom3" { xfail *-*-* } } } */
 /* { dg-final { cleanup-tree-dump "dom3" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr22591.c b/gcc/testsuite/gcc.dg/tree-ssa/pr22591.c
new file mode 100644 (file)
index 0000000..f1f5ec8
--- /dev/null
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+void abort (); 
+typedef struct _Node 
+{ 
+  struct _Node *next, *prev; 
+} Node; 
+void __attribute__ ((noinline)) append (Node * q, Node * p) 
+{ 
+  p->next = q; 
+  p->prev = q; 
+  q->next = p; 
+  q->prev = p; 
+} 
+inline void 
+swap (Node ** a, Node ** b) 
+{ 
+  Node *tmp = *a; 
+  *a = *b; 
+  *b = tmp; 
+} 
+/* Miscompilation seems to happen here. If one removes the if condition 
+   (which should be true) the program works fine.  */ 
+void 
+ListSwap (Node * x, Node * y) 
+{ 
+  Node *tmp; 
+  if (x->next) 
+    { 
+      swap (&x->next, &y->next); 
+      swap (&x->prev, &y->prev); 
+      x->next->prev = x->prev->next = x; 
+      y->next->prev = y->prev->next = y; 
+    } 
+} 
+int 
+main () 
+{ 
+  Node A, A1, B, B1; 
+  append (&A, &A1); 
+  append (&B, &B1); 
+  ListSwap (&A, &B); 
+  if (&A != A.next->prev) 
+    abort (); 
+
+  return 0;
+}
index 62c741e..d207903 100644 (file)
@@ -1511,23 +1511,6 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set,
 
   alias_stats.tbaa_queries++;
 
-  /* If VAR is a pointer with the same alias set as PTR, then dereferencing
-     PTR can't possibly affect VAR.  Note, that we are specifically testing
-     for PTR's alias set here, not its pointed-to type.  We also can't
-     do this check with relaxed aliasing enabled.  */
-  if (POINTER_TYPE_P (TREE_TYPE (var))
-      && var_alias_set != 0
-      && mem_alias_set != 0)
-    {
-      HOST_WIDE_INT ptr_alias_set = get_alias_set (ptr);
-      if (ptr_alias_set == var_alias_set)
-       {
-         alias_stats.alias_noalias++;
-         alias_stats.tbaa_resolved++;
-         return false;
-       }
-    }
-
   /* If the alias sets don't conflict then MEM cannot alias VAR.  */
   if (!alias_sets_conflict_p (mem_alias_set, var_alias_set))
     {