]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/49651 (nested lambdas and -O3 produced incorrect integer...
authorRichard Guenther <rguenther@suse.de>
Wed, 4 Jan 2012 09:50:13 +0000 (09:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 4 Jan 2012 09:50:13 +0000 (09:50 +0000)
2012-01-04  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/49651
* tree-ssa-structalias.c (type_can_have_subvars): New function.
(var_can_have_subvars): Use it.
(get_constraint_for_1): Only consider subfields if there
can be any.

* gcc.dg/tree-ssa/pta-ptrarith-1.c: Adjust.
* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.

From-SVN: r182866

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
gcc/tree-ssa-structalias.c

index 29866bb523ee3f0889c46cf88abe7df0a9c5f869..0b7afad9efde1c42f7fb65eada4e9bac8518f5ab 100644 (file)
@@ -1,3 +1,11 @@
+2012-01-04  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49651
+       * tree-ssa-structalias.c (type_can_have_subvars): New function.
+       (var_can_have_subvars): Use it.
+       (get_constraint_for_1): Only consider subfields if there
+       can be any.
+
 2012-01-03  Sandra Loosemore  <sandra@codesourcery.com>
 
        Backport from mainline:
index b024311c51c6f8b74c11a716c9ddd18908f2948d..e9ffe531c49372231e68854646d7c93e9dab3721 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-04  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49651
+       * gcc.dg/tree-ssa/pta-ptrarith-1.c: Adjust.
+       * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
+
 2012-01-03  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
index 6db9ba0d8719a74caf187aad32cf2d61a36bb09a..2a60e1daa23a42d4b91bfd9dc92b88c30926ea3d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */
 
 extern void abort (void);
 struct X {
index 85b96b190e211cdc23cae095f5f1c577b5ab9869..ddf934bf8132f35de5aa8bfe97cbbb3bbc9bbd83 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */
 
 extern void abort (void);
 struct X {
index 9c4f5ad0735763ed94ae0a9e134605f74698f05d..4e1b680cddcc07ae05a38522c403ab490f5b3035 100644 (file)
@@ -308,6 +308,7 @@ static varinfo_t first_vi_for_offset (varinfo_t, unsigned HOST_WIDE_INT);
 static varinfo_t first_or_preceding_vi_for_offset (varinfo_t,
                                                   unsigned HOST_WIDE_INT);
 static varinfo_t lookup_vi_for_tree (tree);
+static inline bool type_can_have_subvars (const_tree);
 
 /* Pool of variable info structures.  */
 static alloc_pool variable_info_pool;
@@ -3353,7 +3354,8 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
                return;
 
              cs = *VEC_last (ce_s, *results);
-             if (cs.type == DEREF)
+             if (cs.type == DEREF
+                 && type_can_have_subvars (TREE_TYPE (t)))
                {
                  /* For dereferences this means we have to defer it
                     to solving time.  */
@@ -4981,6 +4983,15 @@ sort_fieldstack (VEC(fieldoff_s,heap) *fieldstack)
   VEC_qsort (fieldoff_s, fieldstack, fieldoff_compare);
 }
 
+/* Return true if T is a type that can have subvars.  */
+
+static inline bool
+type_can_have_subvars (const_tree t)
+{
+  /* Aggregates without overlapping fields can have subvars.  */
+  return TREE_CODE (t) == RECORD_TYPE;
+}
+
 /* Return true if V is a tree that we can have subvars for.
    Normally, this is any aggregate type.  Also complex
    types which are not gimple registers can have subvars.  */
@@ -4996,11 +5007,7 @@ var_can_have_subvars (const_tree v)
   if (!DECL_P (v))
     return false;
 
-  /* Aggregates without overlapping fields can have subvars.  */
-  if (TREE_CODE (TREE_TYPE (v)) == RECORD_TYPE)
-    return true;
-
-  return false;
+  return type_can_have_subvars (TREE_TYPE (v));
 }
 
 /* Return true if T is a type that does contain pointers.  */