re PR tree-optimization/19899 (ICE: tree check: expected real_cst, have integer_cst in const_binop, at fold-const.c:1490 with -ftree-vectorize -msse2)

PR tree-optimization/19899
	* Makefile.in (tree-scalar-evolution.o): Add real.h.
	* tree-scalar-evolution.c: Include real.h.
	(add_to_evolution): Build constant -1 of correct type.

	* gcc.dg/tree-ssa/scev-1.c: New test.
	* gcc.dg/tree-ssa/scev-2.c: New test.

From-SVN: r102695
This commit is contained in:
Volker Reichelt 2005-08-03 14:18:56 +00:00 committed by Volker Reichelt
parent 3ed831a4a7
commit 9d2b0e128a
6 changed files with 57 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-08-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR tree-optimization/19899
* Makefile.in (tree-scalar-evolution.o): Add real.h.
* tree-scalar-evolution.c: Include real.h.
(add_to_evolution): Build constant -1 of correct type.
2005-08-03 Jan Hubicka <jh@suse.cz>
* cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.

View File

@ -1945,7 +1945,7 @@ tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) tree-chrec.h tree-pass.h $(PARAMS_H) \
$(DIAGNOSTIC_H) $(VARRAY_H) $(CFGLOOP_H) $(TREE_FLOW_H)
tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) real.h $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
$(TIMEVAR_H) $(CFGLOOP_H) $(SCEV_H) tree-pass.h $(FLAGS_H) tree-chrec.h
tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \

View File

@ -1,3 +1,9 @@
2005-08-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR tree-optimization/19899
* gcc.dg/tree-ssa/scev-1.c: New test.
* gcc.dg/tree-ssa/scev-2.c: New test.
2005-08-03 Richard Sandiford <richard@codesourcery.com>
PR target/18582

View File

@ -0,0 +1,19 @@
/* PR tree-optimization/19899 */
/* Decrementing a floating-point variable in a loop caused an ICE. */
/* { dg-do run } */
/* { dg-options "-O -ftree-vectorize" } */
extern void abort (void);
int main()
{
float i=1;
while (i>=0)
--i;
if (i != -1)
abort();
return 0;
}

View File

@ -0,0 +1,20 @@
/* PR tree-optimization/19899 */
/* Decrementing a floating-point variable in a loop caused an ICE. */
/* { dg-do run } */
/* { dg-options "-O -ftree-vectorize" } */
extern void abort (void);
int main()
{
double a = 20;
int i;
for (i = 0; i < 10; ++i)
a -= 2;
if (a)
abort();
return 0;
}

View File

@ -237,6 +237,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#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, SCALAR_FLOAT_TYPE_P (type)
? build_real (type, dconstm1)
: build_int_cst_type (type, -1));
res = add_to_evolution_1 (loop_nb, chrec_before, to_add);