diff options
author | Jeff Law <law@redhat.com> | 2018-02-20 11:59:22 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2018-02-20 11:59:22 -0700 |
commit | e506dc87a0d7d0f55a6b727885e170dcc2948014 (patch) | |
tree | 68c435e28c54aafe4bc241a5563b5ae14e3adb3d /gcc/gimple-ssa-sprintf.c | |
parent | 04946c6b905572f35f06de34460d20f05203a033 (diff) | |
download | gcc-e506dc87a0d7d0f55a6b727885e170dcc2948014.zip gcc-e506dc87a0d7d0f55a6b727885e170dcc2948014.tar.gz gcc-e506dc87a0d7d0f55a6b727885e170dcc2948014.tar.bz2 |
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 (format_integer): Query EVRP range analyzer
for range data rather than using global data.
* gcc.dg/pr81592.c: New test.
* gcc.dg/pr82123.c: New test.
From-SVN: r257857
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r-- | gcc/gimple-ssa-sprintf.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index b3ffaec..1189d9f 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1451,12 +1451,13 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values) { /* Try to determine the range of values of the integer argument (range information is not available for pointers). */ - 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) { - argmin = wide_int_to_tree (argtype, min); - argmax = wide_int_to_tree (argtype, max); + argmin = vr->min; + argmax = vr->max; /* Set KNOWNRANGE if the argument is in a known subrange of the directive's type and neither width nor precision @@ -1469,11 +1470,12 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values) res.argmin = argmin; res.argmax = argmax; } - else if (range_type == VR_ANTI_RANGE) + else if (vr->type == VR_ANTI_RANGE) { /* Handle anti-ranges if/when bug 71690 is resolved. */ } - else if (range_type == VR_VARYING) + else if (vr->type == VR_VARYING + || vr->type == VR_UNDEFINED) { /* The argument here may be the result of promoting the actual argument to int. Try to determine the type of the actual |