Commit 6a5aca53 by Martin Liska Committed by Martin Liska

Fix ubsan in gimple-fold.c (PR tree-optimization/82491).

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
parent a197d340
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
......
......@@ -6442,13 +6442,9 @@ get_base_constructor (tree base, poly_int64_pod *bit_offset,
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)
......
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