From: Jeff Law Date: Tue, 20 Feb 2018 18:56:56 +0000 (-0700) Subject: re PR middle-end/82123 (spurious -Wformat-overflow warning for converted vars) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5a54a15e30542c3cad550e08f3fd6cfcd4969e30;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 134d5d9efda..161c9aa5051 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 54c91320e56..b3ffaec3ba6 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -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) {