]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR tree-optimization/22319 Fix PR tree-optimization/22140 Fix PR tree-optimizatio...
authorDaniel Berlin <dberlin@dberlin.org>
Wed, 6 Jul 2005 16:49:57 +0000 (16:49 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Wed, 6 Jul 2005 16:49:57 +0000 (16:49 +0000)
2005-07-06  Daniel Berlin  <dberlin@dberlin.org>

Fix PR tree-optimization/22319
Fix PR tree-optimization/22140
Fix PR tree-optimization/22310

* tree-ssa-structalias.c (do_structure_copy): Give up earlier on
variable sized types.
Use correct type for intermediate structure on *a = *b structure
copies.

From-SVN: r101658

gcc/ChangeLog
gcc/tree-ssa-structalias.c

index d25480b6b71fbfdfba90cffb2d2532afd2b3101a..c6c968b3141e8359b67c13ed61a04a824d4e20f3 100644 (file)
@@ -1,3 +1,14 @@
+2005-07-06  Daniel Berlin  <dberlin@dberlin.org>
+
+       Fix PR tree-optimization/22319
+       Fix PR tree-optimization/22140
+       Fix PR tree-optimization/22310
+
+       * tree-ssa-structalias.c (do_structure_copy): Give up earlier on
+       variable sized types.
+       Use correct type for intermediate structure on *a = *b structure
+       copies.
+               
 2005-07-06  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000.h (RS6000_VARARGS_AREA, RS6000_VARARGS_SIZE):
index 96071d62b974699f8fba92d86e90e60cf8c25659..efa22380e05fbb92c876e2564038960e7604c490 100644 (file)
@@ -2396,18 +2396,39 @@ do_structure_copy (tree lhsop, tree rhsop)
     }
   else
     {
+      tree rhstype = TREE_TYPE (rhsop);
+      tree lhstype = TREE_TYPE (lhsop);
+      tree rhstypesize = TYPE_SIZE (rhstype);
+      tree lhstypesize = TYPE_SIZE (lhstype);
+
+      /* If we have a variably sized types on the rhs or lhs, and a deref
+        constraint, add the constraint, lhsconstraint = &ANYTHING.
+        This is conservatively correct because either the lhs is an unknown
+        sized var (if the constraint is SCALAR), or the lhs is a DEREF
+        constraint, and every variable it can point to must be unknown sized
+        anyway, so we don't need to worry about fields at all.  */
+      if ((rhs.type == DEREF && TREE_CODE (rhstypesize) != INTEGER_CST)
+         || (lhs.type == DEREF && TREE_CODE (lhstypesize) != INTEGER_CST))
+       {
+         rhs.var = anything_id;
+         rhs.type = ADDRESSOF;
+         rhs.offset = 0;
+         process_constraint (new_constraint (lhs, rhs));
+         return;
+       }
+
       /* The size only really matters insofar as we don't set more or less of
         the variable.  If we hit an unknown size var, the size should be the
         whole darn thing.  */
       if (get_varinfo (rhs.var)->is_unknown_size_var)
        rhssize = ~0;
       else
-       rhssize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (rhsop)));
+       rhssize = TREE_INT_CST_LOW (rhstypesize);
 
       if (get_varinfo (lhs.var)->is_unknown_size_var)
        lhssize = ~0;
       else
-       lhssize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (lhsop)));
+       lhssize = TREE_INT_CST_LOW (lhstypesize);
 
   
       if (rhs.type == SCALAR && lhs.type == SCALAR)  
@@ -2418,9 +2439,7 @@ do_structure_copy (tree lhsop, tree rhsop)
        do_lhs_deref_structure_copy (lhs, rhs, MIN (lhssize, rhssize));
       else
        {
-         tree rhsdecl = get_varinfo (rhs.var)->decl;
-         tree pointertype = TREE_TYPE (rhsdecl);
-         tree pointedtotype = TREE_TYPE (pointertype);
+         tree pointedtotype = lhstype;
          tree tmpvar;  
 
          gcc_assert (rhs.type == DEREF && lhs.type == DEREF);