re PR target/90972 (ICE in fold_convert_loc, at fold-const.c:2429)
authorRichard Biener <rguenther@suse.de>
Mon, 24 Jun 2019 17:21:40 +0000 (17:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 24 Jun 2019 17:21:40 +0000 (17:21 +0000)
2019-06-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90972
* tree-vect-stmts.c (vect_init_vector): Handle CONSTANT_CLASS_P
in common code, dealing with STRING_CST properly.

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

From-SVN: r272623

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr90972.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index b56cc77396ce98d1525b84f2aad80580693aa955..ad978fd8d79f3010efdb4e381f1a9483fdec0286 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90972
+       * tree-vect-stmts.c (vect_init_vector): Handle CONSTANT_CLASS_P
+       in common code, dealing with STRING_CST properly.
+
 2019-06-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/90930
index 041a81a9350cd7d987b910f7b5b89f2aef21b39a..8a58f4891762f46be8e812e3ce00dbaeac790cdd 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90972
+       * gcc.dg/torture/pr90972.c: New testcase.
+
 2019-06-24  Martin Sebor  <msebor@redhat.com>
 
        * gcc.dg/Wfloat-equal-1.c: Adjust text of expected diagnostic.
diff --git a/gcc/testsuite/gcc.dg/torture/pr90972.c b/gcc/testsuite/gcc.dg/torture/pr90972.c
new file mode 100644 (file)
index 0000000..24f99b0
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mcpu=power8" { target powerpc*-*-* } } */
+
+long f;
+void a();
+void *g()
+{
+  char h[] = {}, j[] = {}, k[] = {}, l[] = {}, m[] = {}, n[] = {}, o[] = {},
+       q[] = {}, r[] = {};
+  static const char i[] = {6, 0};
+  const char *nops[] = {h, i, j, k, l, m, n, o, q, r};
+  long s = 2;
+  void *fill = a;
+  char *p = fill;
+  while (f) {
+      void *b = p;
+      const void *c = nops[1];
+      long d = s, e = __builtin_object_size(b, 0);
+      __builtin___memcpy_chk(b, c, d, e);
+      p += s;
+      f -= s;
+  }
+  return fill;
+}
index 800c000fdc85c638a647247028a9a3ea7b5412d0..47da2953dc79087c84c3fdbb1e67442bf1568b63 100644 (file)
@@ -1481,20 +1481,19 @@ vect_init_vector (stmt_vec_info stmt_info, tree val, tree type,
                  val = new_temp;
                }
            }
-         else if (CONSTANT_CLASS_P (val))
-           val = fold_convert (TREE_TYPE (type), val);
          else
            {
-             new_temp = make_ssa_name (TREE_TYPE (type));
+             gimple_seq stmts = NULL;
              if (! INTEGRAL_TYPE_P (TREE_TYPE (val)))
-               init_stmt = gimple_build_assign (new_temp,
-                                                fold_build1 (VIEW_CONVERT_EXPR,
-                                                             TREE_TYPE (type),
-                                                             val));
+               val = gimple_build (&stmts, VIEW_CONVERT_EXPR,
+                                   TREE_TYPE (type), val);
              else
-               init_stmt = gimple_build_assign (new_temp, NOP_EXPR, val);
-             vect_init_vector_1 (stmt_info, init_stmt, gsi);
-             val = new_temp;
+               /* ???  Condition vectorization expects us to do
+                  promotion of invariant/external defs.  */
+               val = gimple_convert (&stmts, TREE_TYPE (type), val);
+             for (gimple_stmt_iterator gsi2 = gsi_start (stmts);
+                  !gsi_end_p (gsi2); gsi_next (&gsi2))
+               vect_init_vector_1 (stmt_info, gsi_stmt (gsi2), gsi);
            }
        }
       val = build_vector_from_val (type, val);