re PR c/48305 (ice at -O0: verify_gimple failed)

PR c/48305
	* fold-const.c (fold_binary_loc) <case EQ_EXPR, NE_EXPR>: Make sure
	arg10/arg11 in (X ^ Y) == (Z ^ W) are always fold converted to
	matching arg00/arg01 types.

	* gcc.c-torture/compile/pr48305.c: New test.

From-SVN: r171723
This commit is contained in:
Jakub Jelinek 2011-03-30 14:36:18 +02:00 committed by Jakub Jelinek
parent 12486e033e
commit 8a87e7abcb
4 changed files with 31 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2011-03-30 Jakub Jelinek <jakub@redhat.com>
PR c/48305
* fold-const.c (fold_binary_loc) <case EQ_EXPR, NE_EXPR>: Make sure
arg10/arg11 in (X ^ Y) == (Z ^ W) are always fold converted to
matching arg00/arg01 types.
2011-03-30 Eric Botcazou <ebotcazou@adacore.com>
* cfglayout.c (insn_locators_alloc): Initialize curr_location and

View File

@ -12606,13 +12606,21 @@ fold_binary_loc (location_t loc,
operand_equal_p guarantees no side-effects so we don't need
to use omit_one_operand on Z. */
if (operand_equal_p (arg01, arg11, 0))
return fold_build2_loc (loc, code, type, arg00, arg10);
return fold_build2_loc (loc, code, type, arg00,
fold_convert_loc (loc, TREE_TYPE (arg00),
arg10));
if (operand_equal_p (arg01, arg10, 0))
return fold_build2_loc (loc, code, type, arg00, arg11);
return fold_build2_loc (loc, code, type, arg00,
fold_convert_loc (loc, TREE_TYPE (arg00),
arg11));
if (operand_equal_p (arg00, arg11, 0))
return fold_build2_loc (loc, code, type, arg01, arg10);
return fold_build2_loc (loc, code, type, arg01,
fold_convert_loc (loc, TREE_TYPE (arg01),
arg10));
if (operand_equal_p (arg00, arg10, 0))
return fold_build2_loc (loc, code, type, arg01, arg11);
return fold_build2_loc (loc, code, type, arg01,
fold_convert_loc (loc, TREE_TYPE (arg01),
arg11));
/* Optimize (X ^ C1) op (Y ^ C2) as (X ^ (C1 ^ C2)) op Y. */
if (TREE_CODE (arg01) == INTEGER_CST

View File

@ -1,3 +1,8 @@
2011-03-30 Jakub Jelinek <jakub@redhat.com>
PR c/48305
* gcc.c-torture/compile/pr48305.c: New test.
2011-03-29 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/regress/value-dep1.C: New.

View File

@ -0,0 +1,7 @@
/* PR c/48305 */
int
foo (int x)
{
return (x ^ 1) == (x ^ 1U);
}