re PR tree-optimization/52210 (vect_model_simple_cost: reading uninitialised memory)
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Feb 2012 09:16:01 +0000 (10:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 14 Feb 2012 09:16:01 +0000 (10:16 +0100)
PR tree-optimization/52210
* tree-vect-slp.c (vect_get_and_check_slp_defs): Call
vect_model_simple_cost with two entry vect_def_type array instead
of an address of dt.

* gcc.dg/pr52210.c: New test.

From-SVN: r184201

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr52210.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index 0fc9120..863952c 100644 (file)
@@ -1,3 +1,10 @@
+2012-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/52210
+       * tree-vect-slp.c (vect_get_and_check_slp_defs): Call
+       vect_model_simple_cost with two entry vect_def_type array instead
+       of an address of dt.
+
 2012-02-14  Richard Guenther  <rguenther@suse.de>
 
        PR lto/52178
index 38d09e5..09662d8 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/52210
+       * gcc.dg/pr52210.c: New test.
+
 2012-02-14  Jason Merrill  <jason@redhat.com>
 
        PR c++/39055
diff --git a/gcc/testsuite/gcc.dg/pr52210.c b/gcc/testsuite/gcc.dg/pr52210.c
new file mode 100644 (file)
index 0000000..c7ebeb6
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR tree-optimization/52210 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+void
+foo (long *x, long y, long z)
+{
+  long a = x[0];
+  long b = x[1];
+  x[0] = a & ~y;
+  x[1] = b & ~z;
+}
index 1177816..f21abb3 100644 (file)
@@ -321,10 +321,15 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
                 vect_model_store_cost (stmt_info, ncopies_for_cost, false,
                                         dt, slp_node);
              else
-               /* Not memory operation (we don't call this function for
-                  loads).  */
-               vect_model_simple_cost (stmt_info, ncopies_for_cost, &dt,
-                                       slp_node);
+               {
+                 enum vect_def_type dts[2];
+                 dts[0] = dt;
+                 dts[1] = vect_uninitialized_def;
+                 /* Not memory operation (we don't call this function for
+                    loads).  */
+                 vect_model_simple_cost (stmt_info, ncopies_for_cost, dts,
+                                         slp_node);
+               }
            }
        }
       else