From: Richard Biener Date: Mon, 24 Jun 2019 17:21:40 +0000 (+0000) Subject: re PR target/90972 (ICE in fold_convert_loc, at fold-const.c:2429) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d611cec3de1e54091843019a0d02c23493d288ce;p=gcc.git re PR target/90972 (ICE in fold_convert_loc, at fold-const.c:2429) 2019-06-24 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b56cc77396c..ad978fd8d79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-24 Richard Biener + + 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 PR tree-optimization/90930 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 041a81a9350..8a58f489176 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-24 Richard Biener + + PR tree-optimization/90972 + * gcc.dg/torture/pr90972.c: New testcase. + 2019-06-24 Martin Sebor * 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 index 00000000000..24f99b0ebb7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr90972.c @@ -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; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 800c000fdc8..47da2953dc7 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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);