re PR middle-end/40669 (ICE in gimple_assign_set_rhs1 from eliminate_tail_call)

PR middle-end/40669
	* tree-tailcall.c (adjust_return_value_with_ops,
	create_tailcall_accumulator): Set DECL_GIMPLE_REG_P on the temporary
	if it has complex or vector type.

	Backport from mainline:
	2009-06-03  Richard Guenther  <rguenther@suse.de>

	PR middle-end/40328
	* fold-const.c (fold_convert): Fold the build COMPLEX_EXPR.

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

From-SVN: r149329
This commit is contained in:
Jakub Jelinek 2009-07-07 16:07:19 +02:00 committed by Jakub Jelinek
parent 0d38b78518
commit 1282788334
5 changed files with 54 additions and 3 deletions

View File

@ -1,3 +1,16 @@
2009-07-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40669
* tree-tailcall.c (adjust_return_value_with_ops,
create_tailcall_accumulator): Set DECL_GIMPLE_REG_P on the temporary
if it has complex or vector type.
Backport from mainline:
2009-06-03 Richard Guenther <rguenther@suse.de>
PR middle-end/40328
* fold-const.c (fold_convert): Fold the build COMPLEX_EXPR.
2009-07-03 Vladimir Makarov <vmakarov@redhat.com>
PR target/40587

View File

@ -2605,9 +2605,10 @@ fold_convert (tree type, tree arg)
case POINTER_TYPE: case REFERENCE_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
return build2 (COMPLEX_EXPR, type,
fold_convert (TREE_TYPE (type), arg),
fold_convert (TREE_TYPE (type), integer_zero_node));
return fold_build2 (COMPLEX_EXPR, type,
fold_convert (TREE_TYPE (type), arg),
fold_convert (TREE_TYPE (type),
integer_zero_node));
case COMPLEX_TYPE:
{
tree rpart, ipart;

View File

@ -1,3 +1,8 @@
2009-07-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40669
* gcc.dg/pr40669.c: New test.
2009-07-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40551

View File

@ -0,0 +1,26 @@
/* PR middle-end/40669 */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math" } */
double _Complex
test (int d, int t, double *x, double *y, double *z, int n,
double _Complex (*fnp) (double))
{
int m = n / 2;
double min = y[t], max = z[t], med = x[m * d + t];
double _Complex result = 0.0;
if (n == 0)
return 0.0;
if (min > med)
result += test (d, (t + 1) % d, x + (m + 1) * d, y, z, n - m - 1, fnp);
else if (max < med)
result += test (d, (t + 1) % d, x, y, z, m, fnp);
else
{
result += fnp (y[0] + x[m]);
result += test (d, (t + 1) % d, x + (m + 1) * d, y, z, n - m - 1, fnp);
}
return result;
}

View File

@ -573,6 +573,9 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
gimple stmt = gimple_build_assign_with_ops (code, tmp, op0, op1);
tree result;
if (TREE_CODE (ret_type) == COMPLEX_TYPE
|| TREE_CODE (ret_type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (tmp) = 1;
add_referenced_var (tmp);
result = make_ssa_name (tmp, stmt);
gimple_assign_set_lhs (stmt, result);
@ -867,6 +870,9 @@ create_tailcall_accumulator (const char *label, basic_block bb, tree init)
tree tmp = create_tmp_var (ret_type, label);
gimple phi;
if (TREE_CODE (ret_type) == COMPLEX_TYPE
|| TREE_CODE (ret_type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (tmp) = 1;
add_referenced_var (tmp);
phi = create_phi_node (tmp, bb);
/* RET_TYPE can be a float when -ffast-maths is enabled. */