Commit 7fb52af2 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/25290 (PHI-OPT could be rewritten so that is uses fold)

2008-02-27  Richard Guenther  <rguenther@suse.de>

	PR middle-end/25290
	* fold-const.c (fold_unary): Return the correct argument,
	converted to the result type.

	* gcc.c-torture/execute/pr35390.c: New testcase.

From-SVN: r132710
parent 47d43022
2008-02-27 Richard Guenther <rguenther@suse.de>
PR middle-end/25290
* fold-const.c (fold_unary): Return the correct argument,
converted to the result type.
2008-02-27 Richard Guenther <rguenther@suse.de>
PR middle-end/34971
* expr.c (expand_expr_real_1): Assert on rotates that operate
on partial modes.
......
......@@ -8340,7 +8340,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
if (TREE_CODE (arg0) == INTEGER_CST)
return fold_not_const (arg0, type);
else if (TREE_CODE (arg0) == BIT_NOT_EXPR)
return TREE_OPERAND (op0, 0);
return fold_convert (type, TREE_OPERAND (arg0, 0));
/* Convert ~ (-A) to A - 1. */
else if (INTEGRAL_TYPE_P (type) && TREE_CODE (arg0) == NEGATE_EXPR)
return fold_build2 (MINUS_EXPR, type,
......
2008-02-27 Richard Guenther <rguenther@suse.de>
PR middle-end/25290
* gcc.c-torture/execute/pr35390.c: New testcase.
2008-02-27 Samuel Tardieu <sam@rfc1149.net>
PR ada/22255
extern void abort (void);
unsigned int foo (int n)
{
return ~((unsigned int)~n);
}
int main()
{
if (foo(0) != 0)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment