2006-03-07 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Mar 2006 16:23:38 +0000 (16:23 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Mar 2006 16:23:38 +0000 (16:23 +0000)
PR tree-optimization/26587
* tree-ssa-structalias.c (handle_ptr_arith): Handle MINUS_EXPR.

* gcc.dg/torture/pr26587.c: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr26587.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 66eea01..ae089d4 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/26587
+       * tree-ssa-structalias.c (handle_ptr_arith): Handle MINUS_EXPR.
+
 2006-03-07  Richard Sandiford  <richard@codesourcery.com>
 
        * varasm.c (assemble_variable): Fix setting of DECL_IN_TEXT_SECTION.
index 1080e48..b846a4b 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/26587
+       * gcc.dg/torture/pr26587.c: New testcase.
+
 2006-03-06  Paul Thomas  <pault@gcc.gnu.org>
             Erik Edelmann  <eedelman@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr26587.c b/gcc/testsuite/gcc.dg/torture/pr26587.c
new file mode 100644 (file)
index 0000000..fd3c690
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+
+extern void abort(void);
+typedef unsigned int BF_word;
+typedef BF_word BF_key[16 + 2];
+static struct {
+    BF_key P;
+} BF_current;
+int main(void)
+{   
+    BF_word L;
+    BF_word tmp4, *ptr;
+    BF_word i;
+    for (i = 0; i < 16 + 2; i++)
+        BF_current.P[i] = i * 0x98765432;
+    L = 0;
+    ptr = BF_current.P;
+    do {
+        ptr += 2;
+        L ^= BF_current.P[0];
+        tmp4 = L >> 24;
+        L = tmp4 ^ BF_current.P[16 + 1];
+        *(ptr - 2) = L;
+    } while (ptr < &BF_current.P[16 + 2]);
+    if (L != 0x1fdb9752)
+        abort();
+    return 0;
+}
index a9032a3..b5e0830 100644 (file)
@@ -3182,7 +3182,8 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc, tree expr)
   VEC (ce_s, heap) *temp = NULL;
   unsigned int rhsoffset = 0;
 
-  if (TREE_CODE (expr) != PLUS_EXPR)
+  if (TREE_CODE (expr) != PLUS_EXPR
+      && TREE_CODE (expr) != MINUS_EXPR)
     return false;
 
   op0 = TREE_OPERAND (expr, 0);
@@ -3190,7 +3191,8 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc, tree expr)
 
   get_constraint_for (op0, &temp);
   if (POINTER_TYPE_P (TREE_TYPE (op0))
-      && TREE_CODE (op1) == INTEGER_CST)
+      && TREE_CODE (op1) == INTEGER_CST
+      && TREE_CODE (expr) == PLUS_EXPR)
     {
       rhsoffset = TREE_INT_CST_LOW (op1) * BITS_PER_UNIT;
     }