diff options
author | Richard Biener <rguenther@suse.de> | 2023-01-26 08:59:20 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-01-26 13:49:30 +0100 |
commit | c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d (patch) | |
tree | f49abe9f802133f27a862a980a40e74e72d4b53e /gcc/gimple-predicate-analysis.cc | |
parent | 0573a0778af88e805f7630ac8640ecd67d692665 (diff) | |
download | gcc-c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d.zip gcc-c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d.tar.gz gcc-c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d.tar.bz2 |
tree-optimization/108547 - robustify uninit predicate analysis
Predicate analysis, when looking through casts doesn't bother to
convert boundary constants to the type of the bounded variables.
The following robustifies value_sat_pred_p to use widest_ints
to deal with this, like other code in predicate analysis.
PR tree-optimization/108547
* gimple-predicate-analysis.cc (value_sat_pred_p):
Use widest_int.
* gcc.dg/uninit-pr108547.c: New testcase.
Diffstat (limited to 'gcc/gimple-predicate-analysis.cc')
-rw-r--r-- | gcc/gimple-predicate-analysis.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index a7719ff..094e8c7 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -728,11 +728,11 @@ value_sat_pred_p (tree val, tree boundary, tree_code cmpc, if (cmpc != BIT_AND_EXPR) return is_value_included_in (val, boundary, cmpc); - wide_int andw = wi::to_wide (val) & wi::to_wide (boundary); + widest_int andw = wi::to_widest (val) & wi::to_widest (boundary); if (exact_p) - return andw == wi::to_wide (val); + return andw == wi::to_widest (val); - return andw.to_uhwi (); + return wi::ne_p (andw, 0); } /* Return true if the domain of single predicate expression PRED1 |