On 11/19/13 05:00, Richard Sandiford wrote:
The (x >> c) << c folding has:
&& tree_fits_shwi_p (arg1)
&& TREE_INT_CST_LOW (arg1) < prec
&& tree_fits_shwi_p (TREE_OPERAND (arg0, 1))
&& TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < prec)
At first glance the use of tree_fits_shwi_p rather than tree_fits_uhwi_p
made me think this allows negative shift counts, but of course TREE_INT_CST_LOW
is unsigned. I think it'd be clearer to use tree_fits_uhwi_p instead.
Thanks,
Richard
gcc/
* fold-const.c (fold_binary_loc): Use unsigned rather than signed
HOST_WIDE_INTs when folding (x >> c) << c.
OK.
jeff