This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19899] ICE: tree check: expected real_cst, have integer_cst in const_binop, at fold-const.c:1490 with -ftree-vectorize -msse2
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Aug 2005 23:58:26 -0000
- Subject: [Bug tree-optimization/19899] ICE: tree check: expected real_cst, have integer_cst in const_binop, at fold-const.c:1490 with -ftree-vectorize -msse2
- References: <20050211111005.19899.commie1@gmx.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-08-01 23:58 -------
The ICE seems to happen when a floating point number is decremented.
The following code snippet in add_to_evolution looks suspicious:
if (code == MINUS_EXPR)
to_add = chrec_fold_multiply (type, to_add,
build_int_cst_type (type, -1));
This leads to trouble if type is a REAL_TYPE.
The following patch (neither bootstrapped nor regtested) seems to fix
the problem (also in PR23173). Is this a proper fix?
===================================================================
--- tree-scalar-evolution.c 27 Jul 2005 13:26:54 -0000 2.32
+++ tree-scalar-evolution.c 1 Aug 2005 23:43:59 -0000
@@ -237,6 +237,7 @@ Software Foundation, 51 Franklin Street,
#include "tm.h"
#include "ggc.h"
#include "tree.h"
+#include "real.h"
/* These RTL headers are needed for basic-block.h. */
#include "rtl.h"
@@ -866,8 +867,9 @@ add_to_evolution (unsigned loop_nb,
}
if (code == MINUS_EXPR)
- to_add = chrec_fold_multiply (type, to_add,
- build_int_cst_type (type, -1));
+ to_add = chrec_fold_multiply (type, to_add, TREE_CODE (type) == REAL_TYPE
+ ? build_real (type, dconstm1)
+ : build_int_cst_type (type, -1));
res = add_to_evolution_1 (loop_nb, chrec_before, to_add);
===================================================================
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19899