r256258 - in /trunk/gcc: ChangeLog fold-const.c

rsandifo@gcc.gnu.org rsandifo@gcc.gnu.org
Thu Jan 4 18:05:00 GMT 2018


Author: rsandifo
Date: Thu Jan  4 18:05:10 2018
New Revision: 256258

URL: https://gcc.gnu.org/viewcvs?rev=256258&root=gcc&view=rev
Log:
Add tree_fits_uhwi_p tests to BIT_FIELD_REF folder

The first BIT_FIELD_REF folding pattern assumed without checking that
operands satisfy tree_fits_uhwi_p.  The second pattern does check this:

      /* On constants we can use native encode/interpret to constant
         fold (nearly) all BIT_FIELD_REFs.  */
      if (CONSTANT_CLASS_P (arg0)
          && can_native_interpret_type_p (type)
          && BITS_PER_UNIT == 8
          && tree_fits_uhwi_p (op1)
          && tree_fits_uhwi_p (op2))

so this patch adds the checks to the first pattern too.  This is needed
for POLY_INT_CST bit positions.

2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* fold-const.c (fold_ternary_loc): Check tree_fits_uhwi_p before
	using tree_to_uhwi.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c



More information about the Gcc-cvs mailing list