re PR middle-end/36817 (internal compiler error: in compare_values_warnv)

2008-08-21  Richard Guenther  <rguenther@suse.de>

	PR middle-end/36817
	* tree-chrec.c (chrec_apply): Always call chrec_fold_plus which
	makes sure to produce a result of the correct type.

	* gcc.c-torture/compile/pr36817.c: New testcase.

From-SVN: r139385
This commit is contained in:
Richard Guenther 2008-08-21 13:50:30 +00:00 committed by Richard Biener
parent 812dbce5c7
commit 729edaa1bb
4 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2008-08-21 Richard Guenther <rguenther@suse.de>
PR middle-end/36817
* tree-chrec.c (chrec_apply): Always call chrec_fold_plus which
makes sure to produce a result of the correct type.
2008-08-21 Jan Hubicka <jh@suse.cz>
Backport from LTO branch:

View file

@ -1,3 +1,8 @@
2008-08-21 Richard Guenther <rguenther@suse.de>
PR middle-end/36817
* gcc.c-torture/compile/pr36817.c: New testcase.
2008-08-21 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-fre-13.c: Remove XFAIL.

View file

@ -0,0 +1,10 @@
void xxx()
{
unsigned i;
unsigned *p=0;
for(i=0; i<4; ++i)
*p++=0;
for(i=0; i<4; ++i)
*p++=0;
}

View file

@ -579,8 +579,7 @@ chrec_apply (unsigned var,
/* "{a, +, b} (x)" -> "a + b*x". */
x = chrec_convert_rhs (type, x, NULL);
res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
if (!integer_zerop (CHREC_LEFT (chrec)))
res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
}
else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)