2018-02-19 Martin Liska <mliska@suse.cz>
Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82491
* gimple-fold.c (get_base_constructor): Make earlier bail out
to prevent ubsan.
Co-Authored-By: Richard Sandiford <richard.sandiford@linaro.org>
From-SVN: r257816
+2018-02-19 Martin Liska <mliska@suse.cz>
+ Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/82491
+ * gimple-fold.c (get_base_constructor): Make earlier bail out
+ to prevent ubsan.
+
2018-02-19 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-builtin.def: Change NEG macro expansions from
if (TREE_CODE (base) == MEM_REF)
{
- if (!integer_zerop (TREE_OPERAND (base, 1)))
- {
- if (!tree_fits_shwi_p (TREE_OPERAND (base, 1)))
- return NULL_TREE;
- *bit_offset += (mem_ref_offset (base).force_shwi ()
- * BITS_PER_UNIT);
- }
+ poly_offset_int boff = *bit_offset + mem_ref_offset (base) * BITS_PER_UNIT;
+ if (!boff.to_shwi (bit_offset))
+ return NULL_TREE;
if (valueize
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)