From 3c0c8f9dff5c2fd1e71fcbc5c05a65a33caa0303 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Sun, 21 Aug 2005 12:59:15 +0200 Subject: [PATCH] re PR tree-optimization/23433 (ICE: tree check: expected real_cst, have integer_cst in const_binop, at fold-const.c:1512) PR tree-optimization/23433 * tree-chrec.c (chrec_apply): Translate INTEGER_CST to a REAL_CST when the type is SCALAR_FLOAT_TYPE_P. From-SVN: r103317 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/tree-ssa/pr23433.c | 12 ++++++++++++ gcc/tree-chrec.c | 3 +++ 3 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr23433.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e2b4d8ed70..1329cf2f581 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-08-21 Sebastian Pop + + PR tree-optimization/23433 + * tree-chrec.c (chrec_apply): Translate INTEGER_CST to a + REAL_CST when the type is SCALAR_FLOAT_TYPE_P. + 2005-08-21 Sebastian Pop PR tree-optimization/23434 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23433.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23433.c new file mode 100644 index 00000000000..464d4b54254 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23433.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double transport_sumexp(int numexp) +{ + int k,j; + double xk1 = 1.0; + for(k=1; k<=numexp;k++) + for(j=1;j<=3;j++) + xk1 += 1.0; + return xk1; +} diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 87cc148c1a7..8dae9167ef6 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -539,6 +539,9 @@ chrec_apply (unsigned var, if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "(chrec_apply \n"); + if (TREE_CODE (x) == INTEGER_CST && SCALAR_FLOAT_TYPE_P (type)) + x = build_real_from_int_cst (type, x); + if (evolution_function_is_affine_p (chrec)) { /* "{a, +, b} (x)" -> "a + b*x". */