Commit 01f834e3 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/65014 (ice with error: type mismatch in shift expression)

	PR tree-optimization/65014
	* fold-const.c (fold_binary_loc): When creating {L,R}ROTATE_EXPR,
	use original second operand of arg0 or arg1 instead of
	that adjusted by STRIP_NOPS.

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

From-SVN: r220640
parent faedeff7
2015-02-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65014
* fold-const.c (fold_binary_loc): When creating {L,R}ROTATE_EXPR,
use original second operand of arg0 or arg1 instead of
that adjusted by STRIP_NOPS.
2015-02-11 Jeff Law <law@redhat.com>
PR target/63347
......
......@@ -10261,7 +10261,9 @@ fold_binary_loc (location_t loc,
tem = build2_loc (loc, LROTATE_EXPR,
TREE_TYPE (TREE_OPERAND (arg0, 0)),
TREE_OPERAND (arg0, 0),
code0 == LSHIFT_EXPR ? tree01 : tree11);
code0 == LSHIFT_EXPR
? TREE_OPERAND (arg0, 1)
: TREE_OPERAND (arg1, 1));
return fold_convert_loc (loc, type, tem);
}
else if (code11 == MINUS_EXPR)
......@@ -10283,7 +10285,8 @@ fold_binary_loc (location_t loc,
? LROTATE_EXPR
: RROTATE_EXPR),
TREE_TYPE (TREE_OPERAND (arg0, 0)),
TREE_OPERAND (arg0, 0), tree01));
TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg0, 1)));
}
else if (code01 == MINUS_EXPR)
{
......@@ -10304,7 +10307,7 @@ fold_binary_loc (location_t loc,
? LROTATE_EXPR
: RROTATE_EXPR),
TREE_TYPE (TREE_OPERAND (arg0, 0)),
TREE_OPERAND (arg0, 0), tree11));
TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 1)));
}
}
}
......
2015-02-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65014
* gcc.c-torture/compile/pr65014.c: New test.
2015-02-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/57822
......
/* PR tree-optimization/65014 */
/* { dg-do compile { target int32plus } } */
extern int x;
unsigned
foo (unsigned int y)
{
return (y << ((__INTPTR_TYPE__) &x)) | (y >> (32 - ((__INTPTR_TYPE__) &x)));
}
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