tree-chrec.c (chrec_convert_1): Only fold (T2)(t +- x) to (T2)t +- (T2)x if only integer types are involved.

* tree-chrec.c (chrec_convert_1): Only fold (T2)(t +- x) to
	(T2)t +- (T2)x if only integer types are involved.

	* gcc.c-torture/compile/20091215-1.c: New test.

From-SVN: r155288
This commit is contained in:
Jakub Jelinek 2009-12-16 13:47:40 +01:00 committed by Jakub Jelinek
parent 9245e113af
commit dc01fed168
4 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-12-16 Jakub Jelinek <jakub@redhat.com>
* tree-chrec.c (chrec_convert_1): Only fold (T2)(t +- x) to
(T2)t +- (T2)x if only integer types are involved.
2009-12-16 Ben Elliston <bje@au.ibm.com>
* tree-data-ref.h (dot_rdg): Remove prototype.

View File

@ -1,5 +1,7 @@
2009-12-16 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20091215-1.c: New test.
* gcc.dg/debug/tls-1.c: New test.
2009-12-15 Jason Merrill <jason@redhat.com>

View File

@ -0,0 +1,15 @@
void bar ();
void
foo (void *x, short y)
{
bar (x, y + 1);
}
void
bar (x, y)
void *x;
char *y;
{
baz (y);
}

View File

@ -1293,6 +1293,8 @@ keep_cast:
if (use_overflow_semantics
&& (TREE_CODE (chrec) == PLUS_EXPR
|| TREE_CODE (chrec) == MINUS_EXPR)
&& TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (ct) == INTEGER_TYPE
&& TYPE_PRECISION (type) > TYPE_PRECISION (ct)
&& TYPE_OVERFLOW_UNDEFINED (ct))
res = fold_build2 (TREE_CODE (chrec), type,