------- Comment #24 from rguenth at gcc dot gnu dot org  2007-04-21 18:38 
-------
Actually the handle_ptr_arith change made a difference as we (luckily?)
for D.2147_17 = D.2144_14 + D.2146_16

  D.2144_14 = a_11->begin;
  D.2145_15 = i_1 * 4;
  D.2146_16 = (const int *) D.2145_15;
  D.2147_17 = D.2144_14 + D.2146_16;

add a constraint for offset zero (that's pure luck) for D.2144_14.  So, the
difference in constraints good vs. bad is

@@ -26,10 +26,10 @@
 D.2144_14 = *a_11
 D.2146_16 = &ANYTHING
 D.2147_17 = D.2144_14
+D.2147_17 = D.2146_16
 ESCAPED_VARS = D.2092_25

 Collapsing static cycles and doing variable substitution:
-Collapsing D.2147_17 into D.2144_14
 Collapsing this_7 into D.2140_6
 Collapsing NONLOCAL.8 into ESCAPED_VARS

@@ -54,7 +54,7 @@
 a_11 = { D.2142 }
 D.2144_14 = { D.2141 D.2141.32 }
 D.2146_16 = { ANYTHING }
-D.2147_17 = { D.2141 D.2141.32 }
+D.2147_17 = { ANYTHING D.2141 D.2141.32 }
 D.2092_25 = { }

 main: Total number of aliased vops: 3


Unrelated to this the following resolves possible problems in handle_ptr_arith:

Index: tree-ssa-structalias.c
===================================================================
--- tree-ssa-structalias.c      (revision 124018)
+++ tree-ssa-structalias.c      (working copy)
@@ -3287,7 +3287,7 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc
   unsigned int i = 0;
   unsigned int j = 0;
   VEC (ce_s, heap) *temp = NULL;
-  unsigned int rhsoffset = 0;
+  unsigned HOST_WIDE_INT rhsoffset = 0;

   if (TREE_CODE (expr) != PLUS_EXPR
       && TREE_CODE (expr) != MINUS_EXPR)
@@ -3298,8 +3298,10 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc

   get_constraint_for (op0, &temp);
   if (POINTER_TYPE_P (TREE_TYPE (op0))
-      && TREE_CODE (op1) == INTEGER_CST
-      && TREE_CODE (expr) == PLUS_EXPR)
+      && host_integerp (op1, 0)
+      && TREE_CODE (expr) == PLUS_EXPR
+      /* Make sure the pointer offset is positive.  */
+      && tree_int_cst_msb (op1) == 0)
     {
       rhsoffset = TREE_INT_CST_LOW (op1) * BITS_PER_UNIT;
     }

though that last multiplication may still overflow.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30567

Reply via email to