re PR middle-end/82123 (spurious -Wformat-overflow warning for converted vars)

PR middle-end/82123
	PR tree-optimization/81592
	PR middle-end/79257
	* gimple-ssa-sprintf.c (get_int_range): Query EVRP range analyzer for
	range data rather than using global data.

From-SVN: r257855
This commit is contained in:
Jeff Law 2018-02-20 11:56:56 -07:00 committed by Jeff Law
parent bbe2e114ef
commit 5a54a15e30
2 changed files with 8 additions and 5 deletions

View file

@ -3,6 +3,8 @@
PR middle-end/82123
PR tree-optimization/81592
PR middle-end/79257
* gimple-ssa-sprintf.c (get_int_range): Query EVRP range analyzer for
range data rather than using global data.
* gimple-ssa-sprintf.c (get_int_range): Accept vr_values parameter
pass it to children as needed.
(struct directive::fmtresult): Similarly.

View file

@ -1149,9 +1149,10 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
&& TYPE_PRECISION (argtype) <= TYPE_PRECISION (type))
{
/* Try to determine the range of values of the integer argument. */
wide_int min, max;
enum value_range_type range_type = get_range_info (arg, &min, &max);
if (range_type == VR_RANGE)
value_range *vr = vr_values->get_value_range (arg);
if (vr->type == VR_RANGE
&& TREE_CODE (vr->min) == INTEGER_CST
&& TREE_CODE (vr->max) == INTEGER_CST)
{
HOST_WIDE_INT type_min
= (TYPE_UNSIGNED (argtype)
@ -1160,8 +1161,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
HOST_WIDE_INT type_max = tree_to_uhwi (TYPE_MAX_VALUE (argtype));
*pmin = min.to_shwi ();
*pmax = max.to_shwi ();
*pmin = TREE_INT_CST_LOW (vr->min);
*pmax = TREE_INT_CST_LOW (vr->max);
if (*pmin < *pmax)
{