re PR middle-end/26622 (ICE in extract_insn, at recog.c:2084)

gcc/
	PR tree-optimization/26622.
	* fold-const.c (fold_ternary) <COND_EXPR>: Call fold_convert
	on arg1.

gcc/testsuite/
	PR tree-optimization/26622.
	* gcc.c-torture/compile/pr26622.c: New.

From-SVN: r113956
This commit is contained in:
Kazu Hirata 2006-05-21 15:16:19 +00:00 committed by Kazu Hirata
parent 4d49d44d66
commit 5104d6484a
4 changed files with 22 additions and 2 deletions

View File

@ -5,6 +5,10 @@
simplifications of (eq/ne (xor x y) y) and
(eq/ne (xor x y) x).
PR tree-optimization/26622.
* fold-const.c (fold_ternary) <COND_EXPR>: Call fold_convert
on arg1.
2006-05-21 Bernhard Fischer <aldot@gcc.gnu.org>
* tree-cfg.c: Prune whitespace.

View File

@ -11072,8 +11072,10 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
&& integer_zerop (TREE_OPERAND (arg0, 1))
&& integer_zerop (op2)
&& (tem = sign_bit_p (TREE_OPERAND (arg0, 0), arg1)))
return fold_convert (type, fold_build2 (BIT_AND_EXPR,
TREE_TYPE (tem), tem, arg1));
return fold_convert (type,
fold_build2 (BIT_AND_EXPR,
TREE_TYPE (tem), tem,
fold_convert (TREE_TYPE (tem), arg1)));
/* (A >> N) & 1 ? (1 << N) : 0 is simply A & (1 << N). A & 1 was
already handled above. */

View File

@ -4,6 +4,9 @@
* gcc.c-torture/execute/pr27671-1.c: New.
* gcc.dg/pr27671-2.c: Likewise.
PR tree-optimization/26622.
* gcc.c-torture/compile/pr26622.c: New.
2006-05-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/27613

View File

@ -0,0 +1,11 @@
/* PR middle-end/26622
fold_ternary used to create a tree with mismatching types, causing
(const_int 128) to appear in QImode rtx. */
unsigned char g;
unsigned long long
foo (void)
{
return ((long long) ((g & 0x80) != 0)) << 7;
}