Commit 2d60e929 by Richard Guenther Committed by Richard Biener

re PR middle-end/27743 (Wrong code for ((unsigned) ((a) >> 2)) >> 15)

2006-05-25  Richard Guenther  <rguenther@suse.de>

	PR middle-end/27743
	* fold-const.c (fold_binary): Do not look at the stripped
	op0 for (a OP c1) OP c2 to a OP (c1+c2) shift optimization.

	* gcc.dg/torture/pr27743.c: New testcase.

From-SVN: r114112
parent 466a0c36
2006-05-25 Richard Guenther <rguenther@suse.de>
PR middle-end/27743
* fold-const.c (fold_binary): Do not look at the stripped
op0 for (a OP c1) OP c2 to a OP (c1+c2) shift optimization.
2006-05-25 Eric Botcazou <ebotcazou@adacore.com> 2006-05-25 Eric Botcazou <ebotcazou@adacore.com>
* tree-vrp.c (extract_range_from_assert): Set the range to VARYING * tree-vrp.c (extract_range_from_assert): Set the range to VARYING
......
...@@ -9786,7 +9786,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) ...@@ -9786,7 +9786,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
return NULL_TREE; return NULL_TREE;
/* Turn (a OP c1) OP c2 into a OP (c1+c2). */ /* Turn (a OP c1) OP c2 into a OP (c1+c2). */
if (TREE_CODE (arg0) == code && host_integerp (arg1, false) if (TREE_CODE (op0) == code && host_integerp (arg1, false)
&& TREE_INT_CST_LOW (arg1) < TYPE_PRECISION (type) && TREE_INT_CST_LOW (arg1) < TYPE_PRECISION (type)
&& host_integerp (TREE_OPERAND (arg0, 1), false) && host_integerp (TREE_OPERAND (arg0, 1), false)
&& TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < TYPE_PRECISION (type)) && TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < TYPE_PRECISION (type))
......
2006-05-25 Richard Guenther <rguenther@suse.de>
PR middle-end/27743
* gcc.dg/torture/pr27743.c: New testcase.
2006-05-25 Eric Botcazou <ebotcazou@libertysurf.fr> 2006-05-25 Eric Botcazou <ebotcazou@libertysurf.fr>
* gfortran.dg/large_real_kind_form_io_2.f90: UnXFAIL on SPARC/Solaris. * gfortran.dg/large_real_kind_form_io_2.f90: UnXFAIL on SPARC/Solaris.
/* { dg-do run } */
extern void abort(void);
int bar(int a)
{
return ((unsigned) ((a) >> 2)) >> 15;
}
int main()
{
if (bar (0xffff3000) != 0x1ffff)
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