summaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2018-02-20 11:53:29 -0700
committerJeff Law <law@gcc.gnu.org>2018-02-20 11:53:29 -0700
commitc3684506742ca3669add18eafdefb8a30871afb6 (patch)
treedef948dee512f3b6736f65b68b140725b979d59d /gcc/gimple-ssa-sprintf.c
parentaa67d03c30f907fd47adfadff3fb7c58c0b437d1 (diff)
downloadgcc-c3684506742ca3669add18eafdefb8a30871afb6.tar.gz
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 (sprintf_dom_walker::handle_gimple_call): Query the EVRP range analyzer for range data rather than using global data. From-SVN: r257853
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 545f8337c13..4b2de6d2aa4 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -3903,16 +3903,13 @@ sprintf_dom_walker::handle_gimple_call (gimple_stmt_iterator *gsi)
/* Try to determine the range of values of the argument
and use the greater of the two at level 1 and the smaller
of them at level 2. */
- wide_int min, max;
- enum value_range_type range_type
- = get_range_info (size, &min, &max);
- if (range_type == VR_RANGE)
- {
- dstsize
- = (warn_level < 2
- ? wi::fits_uhwi_p (max) ? max.to_uhwi () : max.to_shwi ()
- : wi::fits_uhwi_p (min) ? min.to_uhwi () : min.to_shwi ());
- }
+ value_range *vr = evrp_range_analyzer.get_value_range (size);
+ if (vr->type == VR_RANGE
+ && TREE_CODE (vr->min) == INTEGER_CST
+ && TREE_CODE (vr->max) == INTEGER_CST)
+ dstsize = (warn_level < 2
+ ? TREE_INT_CST_LOW (vr->max)
+ : TREE_INT_CST_LOW (vr->min));
/* The destination size is not constant. If the function is
bounded (e.g., snprintf) a lower bound of zero doesn't