summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-21 10:59:15 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-21 10:59:15 +0000
commitdd2a65b3501c4fd34507eef355c86d6fec272253 (patch)
treed097feb94c994e2b67ffb22d4d80271209456b40 /gcc
parentf046ae741353b7f3fce681f726f246b8ce186983 (diff)
downloadgcc-dd2a65b3501c4fd34507eef355c86d6fec272253.tar.gz
PR tree-optimization/23433
* tree-chrec.c (chrec_apply): Translate INTEGER_CST to a REAL_CST when the type is SCALAR_FLOAT_TYPE_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103317 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr23433.c12
-rw-r--r--gcc/tree-chrec.c3
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6e2b4d8ed70..1329cf2f581 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 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". */