Commit 51935318 by Richard Sandiford Committed by Richard Sandiford

fold-const.c (fold_binary_loc): Use unsigned rather than signed HOST_WIDE_INTs…

fold-const.c (fold_binary_loc): Use unsigned rather than signed HOST_WIDE_INTs when folding (x >> c) << c.

gcc/
	* fold-const.c (fold_binary_loc): Use unsigned rather than signed
	HOST_WIDE_INTs when folding (x >> c) << c.

From-SVN: r205101
parent 6b3b8c27
2013-11-20 Richard Sandiford <rdsandiford@googlemail.com>
* fold-const.c (fold_binary_loc): Use unsigned rather than signed
HOST_WIDE_INTs when folding (x >> c) << c.
2013-11-20 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> 2013-11-20 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
Dominik Vogt <vogt@linux.vnet.ibm.com> Dominik Vogt <vogt@linux.vnet.ibm.com>
...@@ -12679,13 +12679,13 @@ fold_binary_loc (location_t loc, ...@@ -12679,13 +12679,13 @@ fold_binary_loc (location_t loc,
if (((code == LSHIFT_EXPR && TREE_CODE (arg0) == RSHIFT_EXPR) if (((code == LSHIFT_EXPR && TREE_CODE (arg0) == RSHIFT_EXPR)
|| (TYPE_UNSIGNED (type) || (TYPE_UNSIGNED (type)
&& code == RSHIFT_EXPR && TREE_CODE (arg0) == LSHIFT_EXPR)) && code == RSHIFT_EXPR && TREE_CODE (arg0) == LSHIFT_EXPR))
&& tree_fits_shwi_p (arg1) && tree_fits_uhwi_p (arg1)
&& TREE_INT_CST_LOW (arg1) < prec && tree_to_uhwi (arg1) < prec
&& tree_fits_shwi_p (TREE_OPERAND (arg0, 1)) && tree_fits_uhwi_p (TREE_OPERAND (arg0, 1))
&& TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < prec) && tree_to_uhwi (TREE_OPERAND (arg0, 1)) < prec)
{ {
HOST_WIDE_INT low0 = TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)); HOST_WIDE_INT low0 = tree_to_uhwi (TREE_OPERAND (arg0, 1));
HOST_WIDE_INT low1 = TREE_INT_CST_LOW (arg1); HOST_WIDE_INT low1 = tree_to_uhwi (arg1);
tree lshift; tree lshift;
tree arg00; tree arg00;
......
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