re PR target/90972 (ICE in fold_convert_loc, at fold-const.c:2429)

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
This commit is contained in:
Richard Biener 2019-06-24 17:21:40 +00:00 committed by Richard Biener
parent bab9de71b4
commit d611cec3de
4 changed files with 44 additions and 10 deletions

View 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

View 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.

View File

@ -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;
}

View 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);