diff options
author | Sebastian Pop <pop@cri.ensmp.fr> | 2005-08-21 12:59:15 +0200 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2005-08-21 10:59:15 +0000 |
commit | 3c0c8f9dff5c2fd1e71fcbc5c05a65a33caa0303 (patch) | |
tree | d097feb94c994e2b67ffb22d4d80271209456b40 | |
parent | 00c59348b92a7448954687f285bf9ea41bf16f12 (diff) | |
download | gcc-3c0c8f9dff5c2fd1e71fcbc5c05a65a33caa0303.zip gcc-3c0c8f9dff5c2fd1e71fcbc5c05a65a33caa0303.tar.gz gcc-3c0c8f9dff5c2fd1e71fcbc5c05a65a33caa0303.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr23433.c | 12 | ||||
-rw-r--r-- | gcc/tree-chrec.c | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e2b4d8..1329cf2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2005-08-21 Sebastian Pop <pop@cri.ensmp.fr> + 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 <pop@cri.ensmp.fr> + PR tree-optimization/23434 * tree-ssa-loop-niter.c (proved_non_wrapping_p): Give up when the iteration bound is not an INTEGER_CST. 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 0000000..464d4b5 --- /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 87cc148..8dae916 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". */ |