This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]